I feel I’ve been quite successful last few days, getting my OpenGL application up and running, with textures and lights and colors and all, thanks to a great deal of very helpful documentation on the interweb. But I can find no mention on google, these forums, the FAQ or common problems lists, or elsewhere, of the particular issue I’m running into now.
My application (I won’t post code at this stage, but it follows typical form from OpenGL examples, and I don’t think it’s relevant to the issue) uses SDL to open a window with an OpenGL context. Then it does the usual basic stuff, rendering a surface with a bunch of vertices with normals, and a single light set up above it, to produce nice lit terrain. All works fine.
Sometimes. This is the issue - on some executions, it does what is expected. On some executions, the light is in the wrong place. On some, the light is entirely absent (or perhaps under the surface so I can’t see its effects).
So the question is - how can the behaviour of my application be different on different instantiations? I am very willing to believe that this is an SDL-specific issue; I’ve searched for it under that assumption and also turned up nothing, so I figured I would eliminate it as an OpenGL issue first.
I’ve taken every care I can to ensure that it is not a threading issue (though it certainly sounds like one). I make sure that my OpenGL context is open and fully created (going so far as to pause for a second) before I make any calls to OpenGL from my own code. The only thread that is calling GL functions is my applications’s main thread (the only other thread is whatever SDL is running in the background, and that is only servicing keyboard events).
It may be helpful to note that everything seems to work exactly correctly except the lighting, and that is quite entirely variable. I can’t make it go one way or the other by starting the application from a prompt (which slows it down a bit through the use of stdout) or by double-click, or through the IDE. I just can’t get any hints out of it at all as to the cause :(.
Thus, I’m hoping only that someone has ever heard of such a thing. I have googled until I’m blue in the face, and seen no mention of it. In case it’s a known bug in my card or drivers, my platform is Windows 7, GeForce 8600GT, OpenGL supplied by MS SDK.
Thanks, in advance