status in OpenGL can be a costly operation. However, it does not explain exactly which state changes can hurt the performance.
Anyway, my program surely does a lot of unnessecary state changes when it comes to, for example, setting Culling or Blending modus.
Each group of objects (sorted on material) enables or disabled face culling, a certain blend modus, and eventually an alpha function for transparency purposes.
In practice, the culling is the same(enabled) for 9 out of 10 objects, and the same for setting the (alpha)blending modus. So, glEnable / glAlphaFunc are getting called quite a lot of times while nothing will change effectively. I could prevent this by keeping track of the last modus:
if lastCullMode = cullDisabled then
glEnable( GL_CULL_FACE ); // only call this when it was disabled previously
But... Maybe OpenGL does such a check itself already. Plus, does it really makes a difference? The "if then" statement in my own code
takes CPU power as well, so...
Rick