Export (0) Print
Expand All

glPushClientAttrib, glPopClientAttrib

The glPushClientAttrib and glPopClientAttrib functions save and restore groups of client-state variables on the client-attribute stack.

void glPushClientAttrib(
  GLbitfield mask


A mask that indicates which attributes to save. The following are the symbolic mask constants and their associated OpenGL client state:
Value Meaning
GL_CLIENT_PIXEL_STORE_BIT Pixel storage mode attributes.
GL_CLIENT_VERTEX_ARRAY_BIT Vertex array attributes.
GL_CLIENT_ALL_ATTRIB_BITS All stackable client-state attributes.

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 use the bitwise OR operator to join 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:



Error Codes

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.


  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Gl.h.
  Library: Use Opengl32.lib.

See Also

glColorPointer, glDisableClientState, glEdgeFlagPointer, glEnableClientState, glGet, glGetError, glIndexPointer, glNormalPointer, glNewList, glPixelStore, glPushAttrib, glTexCoordPointer, glVertexPointer


Community Additions

© 2015 Microsoft