View Full Version : Save/Load GL Settings

06-10-2010, 11:50 PM
I have some different effects in one application.
Each effect needs different GL settings like glEnable(GL_LIGHTING), glEnable(GL_BLEND) and so on...

Before I start an effect, I would like to save all current GL settings and reload them after the effect is finished.

Now i have two functions like:

setupSettingsForMe(){ glEnable(something) }


setupSettingsForThem() { glDisable(something) }

GL Starter
06-13-2010, 06:19 AM

If you are using same rendering context, then you can use
glPushAttrib() and glPopAttrib() to save all settings.
The special mask GL_ALL_ATTRIB_BITS can be used to save all stackable states.

If rendering contexts are different, then need to call glGet() for each changeable attribute and save. Then call glGet.