View Full Version : Help! what does this actually do?
In sample program, they use glPushAttrib(GL_ENABLE_BIT); or glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
then the draw code, then
If I comment out the push/pop Attrib lines, it don't change program that I can see, so what do those lines do, and is there a reason to use them?
I look at some docs, but they don't really explain in clearly enough, or maybe I am just not understand them.
Ideas what it really do?
04-11-2002, 11:59 AM
Someone else might be able to explain this better, but basically, they push the variables specified in the glPushAttrib() function onto the stack; that way, if you change a setting, when glPopAttrib() is called, the old settings are restored. If you aren't changing anything, then those calls shouldn't really matter. However, its just there so that you don't have to save all the current settings to restore after you do you drawing.
Someone please correct me if i'm wrong.
yes, I know that much, but I don't know what the actual paramaters do. (GL_ENABLE_BIT) and so on..
Sorry for confusion.
04-11-2002, 12:41 PM
The argument specifies which OpenGL attributes (or state variables) to push onto the stack.
04-11-2002, 03:05 PM
If you have the OpenGL spec - well, you should - there's a large table in section 6.2, where all OpenGL state is listed. This state is partitioned into different sections, check the 'attribute' field of the table to see what I mean.
Eg, COLOR_CLEAR_VALUE (as set by glClearColor) belongs to the 'color-buffer' category, so it can be pushed by calling glPushAttrib(GL_COLOR_BUFFER_BIT). At the same time, all other state falling into the 'color-buffer' category will be pushed as well.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.