PDA

View Full Version : Question about glDisable/glEnable



Ologon
12-21-2012, 06:59 AM
Hi,
I'm coding a small rendering engine with OpenGL and I have a doubt about glEnable/glDisable:

In my rendering loop I first set a bunch of default states (TEXTURE_2D and vertex/color arrays), then each single object draws itself and finally the default states are disabled before swapping buffers. What I am unsure about is: is it more efficient to enable those default states only once and leave them enabled all the time instead of disabling/enabling them at the start/end of each loop?

aqnuep
12-21-2012, 07:38 AM
The fastest way to do things is to not do them. What I mean here is that if you know that the state doesn't change between objects then don't change it.

Ologon
12-21-2012, 10:54 AM
Ok, perfect. Thanks for your advice!