I used gDEbugger to dump all the OpenGL calls in a frame. I see some redundant GL calls that can be optimized out, but I’m not sure what GL calls are heavy weight. Should I worry about redundant enables/disables? Which OpenGL calls should I be worried about?
The enable/disable can be costly, as it switches things on the hardware pipeline. Depends on the driver implementation too.
I heard people had measurable perf improvements by doing the gl enable/disable only when needed, with something like :
gloabl boolean _texture_2D = false
func myGlEnableTexture2d {
if (_texture_2D) {
// do nothing
} else {
_texture_2D = true;
glEnable(GL_TEXTURE_2D)
}
All they say about state validation stage and cost(from page 53) is definitely still relevant and is actually similar to the remarks from the blog post that “pjcozzi” just gave.