I’m wondering how to reliably reset all state information in OpenGL. Say I have a rendering loop with several passes, each of which contains several texture states, all having differing arguments set, glTexEnv, glTexCoordPointer, you name it. Of course, not all state info is set in the main loop, material objects for example set all states they require to be rendered correctly themselves.
Problem is, when the material changes, the new material involuntarily “inherits” states the old material left. I’ve already put in - with tears in my eyes, because it’s so expensive - pushAttrib and popAttrib to overcome the problem, and it worked, after a fashion. But now I’m stuck for the tenth time with a non-working shadow mapping stage which behaved just fine an hour ago, because somewhere, somehow, a state isn’t reset, and I’m sick of it >:(
So, question: Is there some general purpose “reset everything” call which allows clearing all states, especially those for arb multitexturing, in a single command? PushAttrib and popAttrib dont seem to catch all of it. I know this could be costy, but tracking each single state and making sure all state changes are optimal is an optimization I save for long dark winter nights.
Thanks
Wolfgang