glPushAttrib.3   [plain text]


'\" et  
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp May 22 14:46
.ds Dm 1 May 22 14:
.ds Xs 21569    10
.TH GLPUSHATTRIB 3G
.SH NAME
.B "glPushAttrib, glPopAttrib
\- push and pop the server attribute stack

.SH C SPECIFICATION
void \f3glPushAttrib\fP(
GLbitfield \fImask\fP )
.nf
.fi

.SH PARAMETERS
.TP \w'\f2mask\fP\ \ 'u 
\f2mask\fP
Specifies a mask that indicates which attributes to save. Values for
\f2mask\fP are listed below.
.SH C SPECIFICATION
void \f3glPopAttrib\fP( void )
.nf
.fi

.SH DESCRIPTION
\%\f3glPushAttrib\fP 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.
\f2mask\fP
is typically constructed by ORing several of these constants together.
The special mask
\%\f3GL_ALL_ATTRIB_BITS\fP
can be used to save all stackable states.
.P
The symbolic mask constants and their associated GL state are as follows
(the second column lists which attributes are saved):
.P
.TS
;
l l .
\%\f3GL_ACCUM_BUFFER_BIT\fP	Accumulation buffer clear value

\%\f3GL_COLOR_BUFFER_BIT\fP	\%\f3GL_ALPHA_TEST\fP enable bit
	Alpha test function and reference value
	\%\f3GL_BLEND\fP enable bit
	Blending source and destination functions
	Constant blend color
	Blending equation
	\%\f3GL_DITHER\fP enable bit
	\%\f3GL_DRAW_BUFFER\fP setting
	\%\f3GL_COLOR_LOGIC_OP\fP enable bit
	\%\f3GL_INDEX_LOGIC_OP\fP enable bit
	Logic op function
	Color mode and index mode clear values
	Color mode and index mode writemasks

\%\f3GL_CURRENT_BIT\fP	Current RGBA color
	Current color index
	Current normal vector
	Current texture coordinates
	Current raster position
	\%\f3GL_CURRENT_RASTER_POSITION_VALID\fP flag
	RGBA color associated with current raster position
	Color index associated with current raster position
	Texture coordinates associated with current raster position
	\%\f3GL_EDGE_FLAG\fP flag

\%\f3GL_DEPTH_BUFFER_BIT\fP	\%\f3GL_DEPTH_TEST\fP enable bit
	Depth buffer test function
	Depth buffer clear value
	\%\f3GL_DEPTH_WRITEMASK\fP enable bit

\%\f3GL_ENABLE_BIT\fP	\%\f3GL_ALPHA_TEST\fP flag
	\%\f3GL_AUTO_NORMAL\fP flag
	\%\f3GL_BLEND\fP flag
	Enable bits for the user-definable clipping planes
	\%\f3GL_COLOR_MATERIAL\fP
	\%\f3GL_CULL_FACE\fP flag
	\%\f3GL_DEPTH_TEST\fP flag
	\%\f3GL_DITHER\fP flag
	\%\f3GL_FOG\fP flag
	\%\f3GL_LIGHT\fP\f2i\fP where 0\ <= \f2i\fP<\%\f3GL_MAX_LIGHTS\fP
	\%\f3GL_LIGHTING\fP flag
	\%\f3GL_LINE_SMOOTH\fP flag
	\%\f3GL_LINE_STIPPLE\fP flag
	\%\f3GL_COLOR_LOGIC_OP\fP flag
	\%\f3GL_INDEX_LOGIC_OP\fP flag
	\%\f3GL_MAP1_\fP\f2x\fP where \f2x\fP is a map type
	\%\f3GL_MAP2_\fP\f2x\fP where \f2x\fP is a map type
	\%\f3GL_NORMALIZE\fP flag
	\%\f3GL_POINT_SMOOTH\fP flag
	\%\f3GL_POLYGON_OFFSET_LINE\fP flag
	\%\f3GL_POLYGON_OFFSET_FILL\fP flag
	\%\f3GL_POLYGON_OFFSET_POINT\fP flag
	\%\f3GL_POLYGON_SMOOTH\fP flag
	\%\f3GL_POLYGON_STIPPLE\fP flag
	\%\f3GL_SCISSOR_TEST\fP flag
	\%\f3GL_STENCIL_TEST\fP flag
	\%\f3GL_TEXTURE_1D\fP flag
	\%\f3GL_TEXTURE_2D\fP flag
	\%\f3GL_TEXTURE_3D\fP flag
	Flags \%\f3GL_TEXTURE_GEN_\fP\f2x\fP where \f2x\fP is S, T, R, or Q 

\%\f3GL_EVAL_BIT\fP	\%\f3GL_MAP1_\fP\f2x\fP enable bits, where \f2x\fP is a map type
	\%\f3GL_MAP2_\fP\f2x\fP enable bits, where \f2x\fP is a map type
	1D grid endpoints and divisions
	2D grid endpoints and divisions
	\%\f3GL_AUTO_NORMAL\fP enable bit

\%\f3GL_FOG_BIT\fP	\%\f3GL_FOG\fP enable bit
	Fog color
	Fog density
	Linear fog start
	Linear fog end
	Fog index
	\%\f3GL_FOG_MODE\fP value

\%\f3GL_HINT_BIT\fP	\%\f3GL_PERSPECTIVE_CORRECTION_HINT\fP setting
	\%\f3GL_POINT_SMOOTH_HINT\fP setting
	\%\f3GL_LINE_SMOOTH_HINT\fP setting
	\%\f3GL_POLYGON_SMOOTH_HINT\fP setting
	\%\f3GL_FOG_HINT\fP setting

\%\f3GL_LIGHTING_BIT\fP	\%\f3GL_COLOR_MATERIAL\fP enable bit
	\%\f3GL_COLOR_MATERIAL_FACE\fP value
	Color material parameters that are tracking the current color
	Ambient scene color
	\%\f3GL_LIGHT_MODEL_LOCAL_VIEWER\fP value
	\%\f3GL_LIGHT_MODEL_TWO_SIDE\fP setting
	\%\f3GL_LIGHTING\fP enable bit
	Enable bit for each light
	Ambient, diffuse, and specular intensity for each light
	Direction, position, exponent, and cutoff angle for each light
	Constant, linear, and quadratic attenuation factors for each light
	Ambient, diffuse, specular, and emissive color for each material
	Ambient, diffuse, and specular color indices for each material
	Specular exponent for each material
	\%\f3GL_SHADE_MODEL\fP setting

\%\f3GL_LINE_BIT\fP	\%\f3GL_LINE_SMOOTH\fP flag
	\%\f3GL_LINE_STIPPLE\fP enable bit
	Line stipple pattern and repeat counter
	Line width

\%\f3GL_LIST_BIT\fP	\%\f3GL_LIST_BASE\fP setting

\%\f3GL_PIXEL_MODE_BIT\fP	\%\f3GL_RED_BIAS\fP and \%\f3GL_RED_SCALE\fP settings
	\%\f3GL_GREEN_BIAS\fP and \%\f3GL_GREEN_SCALE\fP values
	\%\f3GL_BLUE_BIAS\fP and \%\f3GL_BLUE_SCALE\fP
	\%\f3GL_ALPHA_BIAS\fP and \%\f3GL_ALPHA_SCALE\fP
	\%\f3GL_DEPTH_BIAS\fP and \%\f3GL_DEPTH_SCALE\fP
	\%\f3GL_INDEX_OFFSET\fP and \%\f3GL_INDEX_SHIFT\fP values
	\%\f3GL_MAP_COLOR\fP and \%\f3GL_MAP_STENCIL\fP flags
	\%\f3GL_ZOOM_X\fP and \%\f3GL_ZOOM_Y\fP factors
	\%\f3GL_READ_BUFFER\fP setting

\%\f3GL_POINT_BIT\fP	\%\f3GL_POINT_SMOOTH\fP flag
	Point size

\%\f3GL_POLYGON_BIT\fP	\%\f3GL_CULL_FACE\fP enable bit
	\%\f3GL_CULL_FACE_MODE\fP value
	\%\f3GL_FRONT_FACE\fP indicator
	\%\f3GL_POLYGON_MODE\fP setting
	\%\f3GL_POLYGON_SMOOTH\fP flag
	\%\f3GL_POLYGON_STIPPLE\fP enable bit
	\%\f3GL_POLYGON_OFFSET_FILL\fP flag
	\%\f3GL_POLYGON_OFFSET_LINE\fP flag
	\%\f3GL_POLYGON_OFFSET_POINT\fP flag
	\%\f3GL_POLYGON_OFFSET_FACTOR\fP
	\%\f3GL_POLYGON_OFFSET_UNITS\fP

\%\f3GL_POLYGON_STIPPLE_BIT\fP	Polygon stipple image

\%\f3GL_SCISSOR_BIT\fP	\%\f3GL_SCISSOR_TEST\fP flag
	Scissor box

\%\f3GL_STENCIL_BUFFER_BIT\fP	\%\f3GL_STENCIL_TEST\fP enable bit
	Stencil function and reference value
	Stencil value mask
	Stencil fail, pass, and depth buffer pass actions
	Stencil buffer clear value
	Stencil buffer writemask

\%\f3GL_TEXTURE_BIT\fP	Enable bits for the four texture coordinates
	Border color for each texture image
	Minification function for each texture image
	Magnification function for each texture image
	Texture coordinates and wrap mode for each texture image
	Color and mode for each texture environment
	Enable bits \%\f3GL_TEXTURE_GEN_\fP\f2x\fP, \f2x\fP is S, T, R, and Q 
	\%\f3GL_TEXTURE_GEN_MODE\fP setting for S, T, R, and Q
	\%\f3glTexGen\fP plane equations for S, T, R, and Q
	Current texture bindings (for example, \%\f3GL_TEXTURE_BINDING_2D\fP)

\%\f3GL_TRANSFORM_BIT\fP	Coefficients of the six clipping planes
	Enable bits for the user-definable clipping planes
	\%\f3GL_MATRIX_MODE\fP value
	\%\f3GL_NORMALIZE\fP flag
	\%\f3GL_RESCALE_NORMAL\fP flag

\%\f3GL_VIEWPORT_BIT\fP	Depth range (near and far)
	Viewport origin and extent
.TE
.P
\%\f3glPopAttrib\fP restores the values of the state variables saved with the last
.br
\%\f3glPushAttrib\fP command.
Those not saved are left unchanged.
.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
Initially, the attribute stack is empty.
.SH NOTES
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 
\%\f3glPushClientAttrib\fP.
.P
The depth of the attribute stack depends on the implementation,
but it must be at least 16.
.P
When the \%\f3GL_ARB_multitexture\fP extension is supported, pushing and
popping texture state apples to all supported texture units.
.SH ERRORS
\%\f3GL_STACK_OVERFLOW\fP is generated if \%\f3glPushAttrib\fP is called while
the attribute stack is full.
.P
\%\f3GL_STACK_UNDERFLOW\fP is generated if \%\f3glPopAttrib\fP is called while
the attribute stack is empty.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glPushAttrib\fP or \%\f3glPopAttrib\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS 
\%\f3glGet\fP with argument \%\f3GL_ATTRIB_STACK_DEPTH\fP
.br
\%\f3glGet\fP with argument \%\f3GL_MAX_ATTRIB_STACK_DEPTH\fP
.SH SEE ALSO
\%\f3glGet\fP,
\%\f3glGetClipPlane\fP,
\%\f3glGetError\fP,
\%\f3glGetLight\fP,
\%\f3glGetMap\fP,
\%\f3glGetMaterial\fP,
.br
\%\f3glGetPixelMap\fP,
\%\f3glGetPolygonStipple\fP,
\%\f3glGetString\fP,
\%\f3glGetTexEnv\fP,
\%\f3glGetTexGen\fP,
\%\f3glGetTexImage\fP,
\%\f3glGetTexLevelParameter\fP,
\%\f3glGetTexParameter\fP,
\%\f3glIsEnabled\fP,
\%\f3glPushClientAttrib\fP