glPushName, glPopName

The glPushName and glPopName functions push and pop the name stack.

void glPushName(
  GLuint name);

Parameters

  • name
    A name that will be pushed onto the name stack.
void glPopName(
 void);

Remarks

The glPushName function causes name to be pushed onto the name stack, which is initially empty. The glPopName function pops one name off the top of the stack. The name stack is used during selection mode to allow sets of rendering commands to be uniquely identified. It consists of an ordered set of unsigned integers.

The name stack is always empty while the render mode is not GL_SELECT. Calls to glPushName or glPopName while the render mode is not GL_SELECT are ignored.

The following functions retrieve information related to glPushName and glPopName:

glGet with argument GL_NAME_STACK_DEPTH

glGet with argument GL_MAX_NAME_STACK_DEPTH

Error Codes

It is an error to push a name onto a full stack, or to pop a name off an empty stack. It is also an error to manipulate the name stack between a call to glBegin and the corresponding call to glEnd. In any of these cases, the error flag is set and no other change is made to the OpenGL state.

The following are the error codes generated and their conditions.

Error code Condition
GL_STACK_OVERFLOW glPushName was called while the name stack was full.
GL_STACK_UNDERFLOW glPopName was called while the name stack was empty.
GL_INVALID_OPERATION glPushName or glPopName was called between a call to glBegin and the corresponding call to glEnd.

Requirements

**  Windows NT/2000:** Requires Windows NT 3.5 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

glBegin, glEnd, glInitNames, glLoadName, glRenderMode, glSelectBuffer