SirKnight

Member
  • Content count

    571
  • Joined

  • Last visited

Community Reputation

316 Neutral

About SirKnight

  • Rank
    Advanced Member
  1. Have you tried using cgGLSetDebugMode(CG_FALSE)? This will avoid the numerous glGetError calls the runtime makes internally. Remember there's also a Cg forum at NVIDIA's developer site where many NVIDIA engineers roam, several from the Cg teams. http://developer.nvidia.com/forums/index.php?showforum=14
  2. OpenGL Rending a Quake 3 BSP under DirectX

    Check this out: http://www.dxquake3.dsl.pipex.com/
  3. Blackjack (a C++ issue)

    Don't use string for this. Use a single char. It's also better for a beginner to avoid using those C++ classes like string and use character arrays instead for strings. They will learn a lot more and become better programmers by doing that. A long time ago, that's what my programming teachers said and I now understand why. Plus, it's faster to do if( ch == 'y' ) assuming ch is a char than it is doing if( ch == "y" ) if ch is of the string class type.
  4. Blackjack (a C++ issue)

    To have your game loop back again, use just that a loop. Any loop would work, but in this case I'd probably use a do { } while(); loop. Make the condition of the while false if the user wants to exit. For random numbers, use the rand() function. See here: http://www.cplusplus.com/reference/clibrary/cstdlib/rand.html That page also has a number guessing example that allows the user to replay the game just like you want.
  5. Difference between using true and TRUE

    Quote:Original post by Anon Mike I don't think the C++ standard specifies the size of bool. Google says that older versions of both gcc and MSVC had bools larger than 1. As other have mentioned bool/true/false are C++ things. BOOL/TRUE/FALSE are Win32 things. Win32 is fundamentally a C API not C++. In general if a function takes a BOOL it's ok to give it a bool. If it returns a BOOL you can stick it in a bool but you may get a (benign) compiler warning. If a function takes or returns a BOOL* then you have to use a honest BOOL*, failing to do this by casting away the compiler's complaint can corrupt memory. Since a BOOL is really an int you have to follow the rules of C. e.g. this is potentially invalid code: BOOL b = Foo(); if (b == TRUE) Whatever(); ...because it's possible for b to be (say) 2 and the test fails. I wouldn't worry much about that. If Foo returns BOOL, then unless the programmer has gone completely insane (which happens ;) then Foo will be returning TRUE or FALSE and everything will be fine. A bad programmer would return numbers directly instead of TRUE or FALSE in this case.
  6. Difference between using true and TRUE

    Quote:Original post by Sneftel true is a C++ keyword referring to one of two possible values for the bool type. TRUE is a macro declared in windows.h that evaluates to -1, which is useful if you're programming in C (blah blah C99 blah) and don't have a real bool type. Since the Windows API was written for C, not C++, they use that convention. I've always seen the windows headers define TRUE to 1, not -1. Not that it matters a whole lot but still. It is more common to see true being 1 though. As of visual studio 2005, it's defined as 1 in windef.h FYI. :)
  7. Learning a language before college?

    Well I started with C when I was a sophomore in HS and the book I had was called something like "Teach yourself C in 21 days." I found it to be quite good. After a year of learning C on my own I took Computer Science I when I was a Junior and then Computer Science II as a senior which taught C++ at the time. I also used any website about programing I could find to help. Google will find some good stuff I hear. ;) I also have an older edition of C++ How To Program by Deitel and I thought it was a great book as it covers a lot and describes things well IMO. The newest edition even has a game programming section using the OGRE engine. I think a good thing for you to do is check out a public library or even a Barnes and Noble. Spend a few hours in there looking at all the C++ books and read through a chapter or two and see what you think. If you have any more questions give me a holler. :) I used to teach C++ as a side job while in college too BTW. :)
  8. OpenGL total openGL noob

    Remember to check out http://nehe.gamedev.net
  9. How to anchor the texture on a sphere

    Quote:Original post by trouble2007 Hi, I had that problem but fixed it by having glTexGeni(GL_S, GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR); glBindTexture (GL_TEXTURE_2D, tex); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); The sphere rotates and everythign rotates fine, but the image(earth texture) is mapped several times instead of being stretched on the whole sphere. Any help would e greatly appreciated. Thanks! Use glTexParameteri with GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T.
  10. OpenGL HLSL CgFX in OpenGL

    D3D FX effects for the most part work just fine in Cg. FX support has improved by a large amount in the past year. Try it out and see how it works. If you have any problems, report them on the Cg forum at developer.nvidia.com/forums.
  11. OpenGL Inverting matrix in Cg

    Keep in mind that calls like cgGLSetStateMatrixParameter internally does a glGetDoublev call which stalls the pipeline (killing performance). You're better off inverting the matrix in your main app (search for fast matrix math libraries) and sending the result to Cg through a CGparameter. I would advise against this function unless you really HAVE to use it for some reason.
  12. Use a namespace. This is the kind of thing namespaces are for. :)
  13. Alt-Enter?

    Have you tried if( keys[VK_RETURN] && keys[VK_ALT] ) or something like that?
  14. Inventions Hardware???

    Quote:Original post by cdoty "When do you intend to remove your floppy from the slot?" That's what SHE said! ;) Sorry...just HAD to say it.
  15. cgGLBindProgram performance issue

    In addition to binding the program, cgGLBindProgram also sets up parameters and textures. So it's definately a function you want to minimize calling.