This is what you should do. Mirror the state you need in local variables so you don’t have to do rendurant state changed, pushing/popping states, or query states.
Anyways, worrying about things like this is the last thing you should do. Trust me, if you worry about it too much, you will never even get your projects half done.
bob, it is up to the opengl implementation, to check, whether a state is enable or not (if changing a state is in fact slower than checking).
i would do it the 1st way. as lobstah stated, pushing and poping do only make sense, if there are many states to switch.
Tolga, yes the implementation can check for redundant state changes internally, but most implementations don’t. It’s considered bad style to do redundant state changes and relying on the driver to sort it out. All this is covered in the FAQ btw.
Well, it’s a matter of opinion. I consider it bad design when a library’s user is forced to keep track of the library’s state in order to avoid making redundant state changes.
[This message has been edited by Jambolo (edited 01-13-2002).]
Thanks for the input Jambolo, of course it’s up to the implementor to do this. The problem is that to do the test slows down a raw glEnable glDisable when the application KNOWS what it is doing.