I’ve been doing a lot of work on the inside of my rendering library. Having finished, I noticed that some code that uses it crashes at random times on simple functions–functions like glCallList, glDisable, glUniform1f, etc.
In my limited tests, calling the same function immediately after catching and ignoring the crash works fine, but then subsequent OpenGL calls fail.
There’s no repeatability–sometimes a program will works fine for the duration of a test. Sometimes, starting the exact same program results in a crash after a few seconds.
The problems I’ve noticed occur in a shadowmapping demo and in a GPU cloth collision detection demo I wrote. In the former, I noticed that disabling materials within the object’s display list seems to fix the problem–but after a thorough search of the materials code, there’s nothing wrong–perhaps materials trigger the effects of a problem elsewhere?
Strange other things are happening too: one glPopMatrix() did not throw a stack underflow error, even though is had no corresponding glPushMatrix(). Removing the call resulted in no change.
I’m not using threads, and I already updated my card’s driver to the latest version, with no effect.
I’m guessing all the problems have to do with an bind to a buffer not being unbound later, or something small like that, but because the problems are irreproducable, and come from what appears to be perfectly sound code, I’m at a loss for what to do!
I don’t fancy redoing all my work. Any possible ideas for what could possibly be going wrong? Any at all? I don’t need an exact solution–the library, although concise, is still enormous–searching it by hand is impossible. I just need to know what sort of situations to look for–what causes these sort of errors?
I’ve already asked IRC, GameDev, and several other sources. Please help! Anything!