The glPushClientAttrib and glPopClientAttrib functions save and restore groups of client-state variables on the client-attribute stack.
void glPushClientAttrib(
GLbitfield mask
);
void glPopClientAttrib(
void void
);
The glPushClientAttrib function uses its mask parameter to determine which groups of client-state variables are saved on the client-attribute stack. You can OR together accepted symbolic constants to set bits and construct a mask.
The glPopClientAttrib function restores the values of the client-state variables last saved with glPushClientAttrib. Client-state variables not previously saved are left unchanged. Pushing attributes onto a full client-attribute stack or popping attributes off an empty stack sets an error flag and no other change is made to the OpenGL state. By default the client attribute stack is empty.
Some OpenGL client-state values cannot be saved on the client-attribute stack. For example, you cannot save the select or feedback states on the client-attribute stack. The depth of the client-attribute stack is at least 16.
The glPushClientAttrib and glPopClientAttrib functions are not compiled into display lists, but are executed immediately.
The glPushClientAttrib and glPopClientAttrib functions can only push and pop pixel storage modes and vertex array client states. You must use glPushAttrib and glPopAttrib to push and pop states that are kept on the server.
Note The glPushClientAttrib and glPopClientAttrib functions are only available in OpenGL version 1.1 or later.
The following functions retrieve information related to glPushClientAttrib and glPopClientAttrib:
glGet with argument GL_CLIENT_ATTRIB_STACK_DEPTH
glGet with argument GL_MAX_CLIENT_ATTRIB_STACK_DEPTH
The following are the error codes generated and their conditions.
Error Code | Condition |
---|---|
GL_STACK_OVERFLOW | glPushClientAttrib was called while the client-attribute stack was full. |
GL_STACK_UNDERFLOW | glPopClientAttrib was called while the client-attribute stack was empty. |
glColorPointer, glDisableClientState, glEdgeFlagPointer, glEnableClientState, glGet, glGetError, glIndexPointer, glNormalPointer, glNewList, glPixelStore, glPushAttrib, glTexCoordPointer, glVertexPointer