Overhead with glEnable / glDisable ?

Simple question: is there any signicant overhead in calling glEnable or glDisable? As in, if I am enabliing or disabling many times per frame, is this just setting a flag or is it doing much more each call?

Hi !

That depends on your hardware, you should try to minimize any state changes as much as possible, one example is to try to collect many things that use the same attributes and render them all at the same time, so just as an example:

glDisable( GL_LIGHTING);
render stuff that does not use lighting
glEnable( GL_LIGHTING);
render everything that does depend on lighting
  

Some times is of course not possible, and many state change does not take much time at all, I guess that also depnds on what you are disabling/enabling.

Mikael