All of this eliminated the need for several hacks in our code:
- We were previously checking at the RenderState level if a state was already applied (using ==) This sped us up, but introduced artifacts because changes internally to the state could not be detected.
- Because of the problem with the hack discussed in point 1, we cleared the list of "currently applied states" at the end of every frame, meaning we had to reapply every state type every frame. Many states never get used in an app or game, and re-disabling them every frame was a big waste of time. Well, now we can track the state of OpenGL from frame to frame, so this is no longer an issue.
- Context changed required reapplying all of the default states every time just to make sure we knew what the current state of things were. Again, no longer needed.
That said, I imagine there are still many bugs in this new code. Still, so far it has held up nicely in the tests and our game code. Give it a whirl today!