How expensive is glPushAttrib(GL_ENABLE_BIT) / glPopAttrib()


Just wanted to know are the above calls efficient enough to be called in realtime applications or should we manage the checks for lighting enable/disable and correspondingly enable/disable Lighting.


Hi !

It depends on the OpenGL driver, but you should count on the fact that it has severe impact on speed…

Reading any value back from OpenGL is normally very expensive, so try the best you can to avoid it.