<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>glPushAttrib</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GL.xml" title="GL"/><link rel="previous" href="glPrioritizeTextures.3G.xml" title="glPrioritizeTextures"/><link rel="next" href="glPushClientAttrib.3G.xml" title="glPushClientAttrib"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">glPushAttrib</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glPrioritizeTextures.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glPushClientAttrib.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glPushAttrib.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glPushAttrib.3G-name"/><h2>Name</h2><p>glPushAttrib, glPopAttrib &#8212; push and pop the server attribute stack</p></div><div class="refsynopsisdiv"><a name="glPushAttrib.3G-c_spec-push"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glPushAttrib</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLbitfield <i><tt>mask</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glPushAttrib.3G-python_spec-push"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glPushAttrib</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>mask</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glPushAttrib.3G-parameters-push"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>mask</tt></i></span></dt><dd>
						Specifies a mask that indicates which attributes to save. Values for <i><tt>mask</tt></i> are listed
						below.
					</dd></dl></div></div><div class="refsynopsisdiv"><a name="glPushAttrib.3G-c_spec-pop"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glPopAttrib</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glPushAttrib.3G-python_spec-pop"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glPopAttrib</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glPushAttrib.3G-description"/><h2>Description</h2><p>
			<tt>glPushAttrib</tt> takes one argument, a mask that indicates which groups of state variables to save on
			the attribute stack. Symbolic constants are used to set bits in the mask. <i><tt>mask</tt></i> is typically
			constructed by ORing several of these constants together. The special mask <tt>GL_ALL_ATTRIB_BITS</tt> can
			be used to save all stackable states.
		</p><p>
			The symbolic mask constants and their associated GL state are as follows (the second column lists which attributes are
			saved):
		</p><div class="informaltable"><table border="1"><colgroup><col/><col/></colgroup><tbody><tr><td><tt>GL_ACCUM_BUFFER_BIT</tt></td><td>Accumulation buffer clear value</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_COLOR_BUFFER_BIT</tt></td><td><tt>GL_ALPHA_TEST</tt> enable bit</td></tr><tr><td> </td><td>Alpha test function and reference value</td></tr><tr><td> </td><td><tt>GL_BLEND</tt> enable bit</td></tr><tr><td> </td><td>Blending source and destination functions</td></tr><tr><td> </td><td>Constant blend color</td></tr><tr><td> </td><td>Blending equation</td></tr><tr><td> </td><td><tt>GL_DITHER</tt> enable bit</td></tr><tr><td> </td><td><tt>GL_DRAW_BUFFER</tt> setting</td></tr><tr><td> </td><td><tt>GL_COLOR_LOGIC_OP</tt> enable bit</td></tr><tr><td> </td><td><tt>GL_INDEX_LOGIC_OP</tt> enable bit</td></tr><tr><td> </td><td>Logic op function</td></tr><tr><td> </td><td>Color mode and index mode clear values</td></tr><tr><td> </td><td>Color mode and index mode writemasks</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_CURRENT_BIT</tt></td><td>Current RGBA color</td></tr><tr><td> </td><td>Current color index</td></tr><tr><td> </td><td>Current normal vector</td></tr><tr><td> </td><td>Current texture coordinates</td></tr><tr><td> </td><td>Current raster position</td></tr><tr><td> </td><td><tt>GL_CURRENT_RASTER_POSITION_VALID</tt> flag</td></tr><tr><td> </td><td>RGBA color associated with current raster position</td></tr><tr><td> </td><td>Color index associated with current raster position</td></tr><tr><td> </td><td>Texture coordinates associated with current raster position</td></tr><tr><td> </td><td><tt>GL_EDGE_FLAG</tt> flag</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_DEPTH_BUFFER_BIT</tt></td><td><tt>GL_DEPTH_TEST</tt> enable bit</td></tr><tr><td> </td><td>Depth buffer test function</td></tr><tr><td> </td><td>Depth buffer clear value</td></tr><tr><td> </td><td><tt>GL_DEPTH_WRITEMASK</tt> enable bit</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_ENABLE_BIT</tt></td><td><tt>GL_ALPHA_TEST</tt> flag</td></tr><tr><td> </td><td><tt>GL_AUTO_NORMAL</tt> flag</td></tr><tr><td> </td><td><tt>GL_BLEND</tt> flag</td></tr><tr><td> </td><td>Enable bits for the user-definable clipping planes</td></tr><tr><td> </td><td><tt>GL_COLOR_MATERIAL</tt></td></tr><tr><td> </td><td><tt>GL_CULL_FACE</tt> flag</td></tr><tr><td> </td><td><tt>GL_DEPTH_TEST</tt> flag</td></tr><tr><td> </td><td><tt>GL_DITHER</tt> flag</td></tr><tr><td> </td><td><tt>GL_FOG</tt> flag</td></tr><tr><td> </td><td><tt>GL_LIGHT</tt><i><tt>i</tt></i> where 0&lt;=
						<i><tt>i</tt></i>&lt;<tt>GL_MAX_LIGHTS</tt></td></tr><tr><td> </td><td><tt>GL_LIGHTING</tt> flag</td></tr><tr><td> </td><td><tt>GL_LINE_SMOOTH</tt> flag</td></tr><tr><td> </td><td><tt>GL_LINE_STIPPLE</tt> flag</td></tr><tr><td> </td><td><tt>GL_COLOR_LOGIC_OP</tt> flag</td></tr><tr><td> </td><td><tt>GL_INDEX_LOGIC_OP</tt> flag</td></tr><tr><td> </td><td><tt>GL_MAP1_</tt><i><tt>x</tt></i> where <i><tt>x</tt></i> is a map
						type</td></tr><tr><td> </td><td><tt>GL_MAP2_</tt><i><tt>x</tt></i> where <i><tt>x</tt></i> is a map
						type</td></tr><tr><td> </td><td><tt>GL_NORMALIZE</tt> flag</td></tr><tr><td> </td><td><tt>GL_POINT_SMOOTH</tt> flag</td></tr><tr><td> </td><td><tt>GL_POLYGON_OFFSET_LINE</tt> flag</td></tr><tr><td> </td><td><tt>GL_POLYGON_OFFSET_FILL</tt> flag</td></tr><tr><td> </td><td><tt>GL_POLYGON_OFFSET_POINT</tt> flag</td></tr><tr><td> </td><td><tt>GL_POLYGON_SMOOTH</tt> flag</td></tr><tr><td> </td><td><tt>GL_POLYGON_STIPPLE</tt> flag</td></tr><tr><td> </td><td><tt>GL_SCISSOR_TEST</tt> flag</td></tr><tr><td> </td><td><tt>GL_STENCIL_TEST</tt> flag</td></tr><tr><td> </td><td><tt>GL_TEXTURE_1D</tt> flag</td></tr><tr><td> </td><td><tt>GL_TEXTURE_2D</tt> flag</td></tr><tr><td> </td><td><tt>GL_TEXTURE_3D</tt> flag</td></tr><tr><td> </td><td>Flags <tt>GL_TEXTURE_GEN_</tt><i><tt>x</tt></i> where <i><tt>x</tt></i> is
						S, T, R, or Q</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_EVAL_BIT</tt></td><td><tt>GL_MAP1_</tt><i><tt>x</tt></i> enable bits, where <i><tt>x</tt></i> is
						a map type</td></tr><tr><td> </td><td><tt>GL_MAP2_</tt><i><tt>x</tt></i> enable bits, where <i><tt>x</tt></i> is
						a map type</td></tr><tr><td> </td><td>1D grid endpoints and divisions</td></tr><tr><td> </td><td>2D grid endpoints and divisions</td></tr><tr><td> </td><td><tt>GL_AUTO_NORMAL</tt> enable bit</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_FOG_BIT</tt></td><td><tt>GL_FOG</tt> enable bit</td></tr><tr><td> </td><td>Fog color</td></tr><tr><td> </td><td>Fog density</td></tr><tr><td> </td><td>Linear fog start</td></tr><tr><td> </td><td>Linear fog end</td></tr><tr><td> </td><td>Fog index</td></tr><tr><td> </td><td><tt>GL_FOG_MODE</tt> value</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_HINT_BIT</tt></td><td><tt>GL_PERSPECTIVE_CORRECTION_HINT</tt> setting</td></tr><tr><td> </td><td><tt>GL_POINT_SMOOTH_HINT</tt> setting</td></tr><tr><td> </td><td><tt>GL_LINE_SMOOTH_HINT</tt> setting</td></tr><tr><td> </td><td><tt>GL_POLYGON_SMOOTH_HINT</tt> setting</td></tr><tr><td> </td><td><tt>GL_FOG_HINT</tt> setting</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_LIGHTING_BIT</tt></td><td><tt>GL_COLOR_MATERIAL</tt> enable bit</td></tr><tr><td> </td><td><tt>GL_COLOR_MATERIAL_FACE</tt> value</td></tr><tr><td> </td><td>Color material parameters that are tracking the current color</td></tr><tr><td> </td><td>Ambient scene color</td></tr><tr><td> </td><td><tt>GL_LIGHT_MODEL_LOCAL_VIEWER</tt> value</td></tr><tr><td> </td><td><tt>GL_LIGHT_MODEL_TWO_SIDE</tt> setting</td></tr><tr><td> </td><td><tt>GL_LIGHTING</tt> enable bit</td></tr><tr><td> </td><td>Enable bit for each light</td></tr><tr><td> </td><td>Ambient, diffuse, and specular intensity for each light</td></tr><tr><td> </td><td>Direction, position, exponent, and cutoff angle for each light</td></tr><tr><td> </td><td>Constant, linear, and quadratic attenuation factors for each light</td></tr><tr><td> </td><td>Ambient, diffuse, specular, and emissive color for each material</td></tr><tr><td> </td><td>Ambient, diffuse, and specular color indices for each material</td></tr><tr><td> </td><td>Specular exponent for each material</td></tr><tr><td> </td><td><tt>GL_SHADE_MODEL</tt> setting</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_LINE_BIT</tt></td><td><tt>GL_LINE_SMOOTH</tt> flag</td></tr><tr><td> </td><td><tt>GL_LINE_STIPPLE</tt> enable bit</td></tr><tr><td> </td><td>Line stipple pattern and repeat counter</td></tr><tr><td> </td><td>Line width</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_LIST_BIT</tt></td><td><tt>GL_LIST_BASE</tt> setting</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_PIXEL_MODE_BIT</tt></td><td><tt>GL_RED_BIAS</tt> and <tt>GL_RED_SCALE</tt> settings</td></tr><tr><td> </td><td><tt>GL_GREEN_BIAS</tt> and <tt>GL_GREEN_SCALE</tt> values</td></tr><tr><td> </td><td><tt>GL_BLUE_BIAS</tt> and <tt>GL_BLUE_SCALE</tt></td></tr><tr><td> </td><td><tt>GL_ALPHA_BIAS</tt> and <tt>GL_ALPHA_SCALE</tt></td></tr><tr><td> </td><td><tt>GL_DEPTH_BIAS</tt> and <tt>GL_DEPTH_SCALE</tt></td></tr><tr><td> </td><td><tt>GL_INDEX_OFFSET</tt> and <tt>GL_INDEX_SHIFT</tt> values</td></tr><tr><td> </td><td><tt>GL_MAP_COLOR</tt> and <tt>GL_MAP_STENCIL</tt> flags</td></tr><tr><td> </td><td><tt>GL_ZOOM_X</tt> and <tt>GL_ZOOM_Y</tt> factors</td></tr><tr><td> </td><td><tt>GL_READ_BUFFER</tt> setting</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_POINT_BIT</tt></td><td><tt>GL_POINT_SMOOTH</tt> flag</td></tr><tr><td> </td><td>Point size</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_POLYGON_BIT</tt></td><td><tt>GL_CULL_FACE</tt> enable bit</td></tr><tr><td> </td><td><tt>GL_CULL_FACE_MODE</tt> value</td></tr><tr><td> </td><td><tt>GL_FRONT_FACE</tt> indicator</td></tr><tr><td> </td><td><tt>GL_POLYGON_MODE</tt> setting</td></tr><tr><td> </td><td><tt>GL_POLYGON_SMOOTH</tt> flag</td></tr><tr><td> </td><td><tt>GL_POLYGON_STIPPLE</tt> enable bit</td></tr><tr><td> </td><td><tt>GL_POLYGON_OFFSET_FILL</tt> flag</td></tr><tr><td> </td><td><tt>GL_POLYGON_OFFSET_LINE</tt> flag</td></tr><tr><td> </td><td><tt>GL_POLYGON_OFFSET_POINT</tt> flag</td></tr><tr><td> </td><td><tt>GL_POLYGON_OFFSET_FACTOR</tt></td></tr><tr><td> </td><td><tt>GL_POLYGON_OFFSET_UNITS</tt></td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_POLYGON_STIPPLE_BIT</tt></td><td>Polygon stipple image</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_SCISSOR_BIT</tt></td><td><tt>GL_SCISSOR_TEST</tt> flag</td></tr><tr><td> </td><td>Scissor box</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_STENCIL_BUFFER_BIT</tt></td><td><tt>GL_STENCIL_TEST</tt> enable bit</td></tr><tr><td> </td><td>Stencil function and reference value</td></tr><tr><td> </td><td>Stencil value mask</td></tr><tr><td> </td><td>Stencil fail, pass, and depth buffer pass actions</td></tr><tr><td> </td><td>Stencil buffer clear value</td></tr><tr><td> </td><td>Stencil buffer writemask</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_TEXTURE_BIT</tt></td><td>Enable bits for the four texture coordinates</td></tr><tr><td> </td><td>Border color for each texture image</td></tr><tr><td> </td><td>Minification function for each texture image</td></tr><tr><td> </td><td>Magnification function for each texture image</td></tr><tr><td> </td><td>Texture coordinates and wrap mode for each texture image</td></tr><tr><td> </td><td>Color and mode for each texture environment</td></tr><tr><td> </td><td>Enable bits <tt>GL_TEXTURE_GEN_</tt><i><tt>x</tt></i>, <i><tt>x</tt></i>
						is S, T, R, and Q</td></tr><tr><td> </td><td><tt>GL_TEXTURE_GEN_MODE</tt> setting for S, T, R, and Q</td></tr><tr><td> </td><td><tt>glTexGen</tt> plane equations for S, T, R, and Q</td></tr><tr><td> </td><td>Current texture bindings (for example, <tt>GL_TEXTURE_BINDING_2D</tt>)</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_TRANSFORM_BIT</tt></td><td>Coefficients of the six clipping planes</td></tr><tr><td> </td><td>Enable bits for the user-definable clipping planes</td></tr><tr><td> </td><td><tt>GL_MATRIX_MODE</tt> value</td></tr><tr><td> </td><td><tt>GL_NORMALIZE</tt> flag</td></tr><tr><td> </td><td><tt>GL_RESCALE_NORMAL</tt> flag</td></tr><tr><td> </td><td> </td></tr><tr><td><tt>GL_VIEWPORT_BIT</tt></td><td>Depth range (near and far)</td></tr><tr><td> </td><td>Viewport origin and extent</td></tr></tbody></table></div><p>
			<tt>glPopAttrib</tt> restores the values of the state variables saved with the last
		</p><p>
			<tt>glPushAttrib</tt> command. Those not saved are left unchanged.
		</p><p>
			It is an error to push attributes onto a full stack, or to pop attributes off an empty stack. In either case, the error
			flag is set and no other change is made to GL state.
		</p><p>
			Initially, the attribute stack is empty.
		</p></div><div class="refsect1" lang="en"><a name="glPushAttrib.3G-notes"/><h2>Notes</h2><p>
			Not all values for GL state can be saved on the attribute stack. For example, render mode state, and select and
			feedback state cannot be saved. Client state must be saved with <a href="glPushClientAttrib.3G.xml"><tt>glPushClientAttrib</tt></a>.
		</p><p>
			The depth of the attribute stack depends on the implementation, but it must be at least 16.
		</p><p>
			When the <tt>GL_ARB_multitexture</tt> extension is supported, pushing and popping texture state apples to
			all supported texture units.
		</p></div><div class="refsect1" lang="en"><a name="glPushAttrib.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_STACK_OVERFLOW</tt> is generated if <tt>glPushAttrib</tt> is called while the attribute
			stack is full.
		</p><p>
			<tt>GL_STACK_UNDERFLOW</tt> is generated if <tt>glPopAttrib</tt> is called while the attribute
			stack is empty.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glPushAttrib</tt> or
			<tt>glPopAttrib</tt> is executed between the execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a>
			and the corresponding execution of <a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
		</p></div><div class="refsect1" lang="en"><a name="glPushAttrib.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGet</tt> with argument <tt>GL_ATTRIB_STACK_DEPTH</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_MAX_ATTRIB_STACK_DEPTH</tt>
		</p></div><div class="refsect1" lang="en"><a name="glPushAttrib.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glGet.3G.xml">glGet</a>, <a href="glGetClipPlane.3G.xml">glGetClipPlane</a>, <a href="glGetError.3G.xml">glGetError</a>, <a href="glGetLight.3G.xml">glGetLight</a>, <a href="glGetMap.3G.xml">glGetMap</a>, <a href="glGetMaterial.3G.xml">glGetMaterial</a>, <a href="glGetPixelMap.3G.xml">glGetPixelMap</a>, <a href="glGetPolygonStipple.3G.xml">glGetPolygonStipple</a>, <a href="glGetString.3G.xml">glGetString</a>, <a href="glGetTexEnv.3G.xml">glGetTexEnv</a>, <a href="glGetTexGen.3G.xml">glGetTexGen</a>, <a href="glGetTexImage.3G.xml">glGetTexImage</a>, <a href="glGetTexLevelParameter.3G.xml">glGetTexLevelParameter</a>, <a href="glGetTexParameter.3G.xml">glGetTexParameter</a>, <a href="glIsEnabled.3G.xml">glIsEnabled</a>, <a href="glPushClientAttrib.3G.xml">glPushClientAttrib</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="glPrioritizeTextures.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="glPushClientAttrib.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glPrioritizeTextures </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glPushClientAttrib</td></tr></table></div></body></html>
