glPushAttrib(3G) OpenGL Reference glPushAttrib(3G)
NAME
glPushAttrib, glPopAttrib - push and pop the attribute stack
C SPECIFICATION
void glPushAttrib( GLbitfield mask )
PARAMETERS
mask Specifies a mask that indicates which attributes to save. Values
for mask are listed in the table below.
C SPECIFICATION
void glPopAttrib( void )
DESCRIPTION
glPushAttrib 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. mask is typically constructed by ORing
several of these constants together. The special mask GLALLATTRIBBITS
can be used to save all stackable states.
The symbolic mask constants and their associated GL state are as follows
(the second column lists which attributes are saved):
GLACCUMBUFFERBIT Accumulation buffer clear value
GLCOLORBUFFERBIT GLALPHATEST enable bit
Alpha test function and reference value
GLBLEND enable bit
Blending source and destination functions
Constant blend color
Blending equation
GLDITHER enable bit
GLDRAWBUFFER setting
GLCOLORLOGICOP enable bit
GLINDEXLOGICOP enable bit
GLLOGICOP enable bit
Logic op function
Color mode and index mode clear values
Color mode and index mode writemasks
GLCURRENTBIT Current RGBA color
Current color index
Current normal vector
Current texture coordinates
Current raster position
GLCURRENTRASTERPOSITIONVALID enable bit
RGBA color associated with current raster
Page 1
glPushAttrib(3G) OpenGL Reference glPushAttrib(3G)
position
Color index associated with current raster
position
Texture coordinates associated with current
raster position
GLEDGEFLAG enable bit
GLDEPTHBUFFERBIT GLDEPTHTEST enable bit
Depth buffer test function
Depth buffer clear value
GLDEPTHWRITEMASK enable bit
GLENABLEBIT GLALPHATEST enable bit
GLAUTONORMAL enable bit
GLBLEND enable bit
GLCALLIGRAPHICFRAGMENTSGIX enable bit
GLCLIPPLANEi enable bits
GLCOLORLOGICOP enable bit
GLCOLORMATERIAL
GLCONVOLUTION1DEXT,
GLCONVOLUTION2DEXT, and
GLSEPARABLE2DEXT enable bits
GLCOLORTABLESGI enable bit
GLCULLFACE enable bit
GLDEPTHTEST enable bit
GLDITHER enable bit
GLFOG enable bit
GLHISTOGRAMEXT enable bit
GLINDEXLOGICOP enable bit
GLINTERLACESGIX enable bit
GLLIGHTi where 0 <= i<GLMAXLIGHTS
GLLIGHTING enable bit
GLLINESMOOTH enable bit
GLLINESTIPPLE enable bit
GLLOGICOP enable bit
GLMAP1x where x is a map type
GLMAP2x where x is a map type
GLMINMAXEXT enable bit
GLMULTISAMPLESGIS enable bit
GLNORMALIZE enable bit
GLPOINTSMOOTH enable bit
GLPOLYGONOFFSETEXT enable bit
GLPOLYGONOFFSETFILL enable bit
GLPOLYGONOFFSETLINE enable bit
GLPOLYGONOFFSETPOINT enable bit
GLPOLYGONSMOOTH enable bit
GLPOLYGONSTIPPLE enable bit
GLPOSTCOLORMATRIXCOLORTABLESGI enable bit
GLPOSTCONVOLUTIONCOLORTABLESGI enable bit
GLREFERENCEPLANESGIX enable bit
Page 2
glPushAttrib(3G) OpenGL Reference glPushAttrib(3G)
GLSAMPLEALPHATOMASKSGIS enable bit
GLSAMPLEALPHATOONESGIS enable bit
GLSAMPLEMASKSGIS enable bit
GLSCISSORTEST enable bit
GLSPRITESGIX enable bit
GLSTENCILTEST enable bit
GLTEXTURE1D enable bit
GLTEXTURE2D enable bit
GLTEXTURECOLORTABLESGI enable bit
Enable bits GLTEXTUREGENx where x is S, T, R, or Q
GLEVALBIT GLMAP1x enable bits, where x is a map type
GLMAP2x enable bits, where x is a map type
1-D grid endpoints and divisions
2-D grid endpoints and divisions
GLAUTONORMAL enable bit
GLFOGBIT GLFOG enable bit
Fog color
Fog density
Linear fog start
Linear fog end
Fog index
GLFOGMODE value
Control points for custom fog blending function
Number of control points
GLFOGOFFSETSGIX enable bit
Fog offset parameters
GLHINTBIT GLPERSPECTIVECORRECTIONHINT setting
GLPOINTSMOOTHHINT setting
GLLINESMOOTHHINT setting
GLPOLYGONSMOOTHHINT setting
GLFOGHINT setting
GLLIGHTINGBIT GLCOLORMATERIAL enable bit
GLCOLORMATERIALFACE value
Color material parameters that are tracking the
current color
Ambient scene color
GLLIGHTMODELLOCALVIEWER value
GLLIGHTMODELTWOSIDE setting
GLLIGHTING 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
Page 3
glPushAttrib(3G) OpenGL Reference glPushAttrib(3G)
Page 4
glPushAttrib(3G) OpenGL Reference glPushAttrib(3G)
Ambient, diffuse, specular, and emissive color
for each material
Ambient, diffuse, and specular color indices
for each material
Specular exponent for each material
GLSHADEMODEL setting
GLLINEBIT GLLINESMOOTH enable bit
GLLINESTIPPLE enable bit
Line stipple pattern and repeat counter
Line width
GLLISTBIT GLLISTBASE setting
GLMULTISAMPLEBITEXT GLMULTISAMPLESGIS enable bit
GLSAMPLEALPHATOMASKSGIS enable bit
GLSAMPLEALPHATOONESGIS enable bit
GLSAMPLEMASKSGIS enable bit
GLSAMPLEMASKVALUESGIS
GLSAMPLEMASKINVERTSGIS
GLSAMPLEPATTERNSGIS
GLPIXELMODEBIT GLREDBIAS and GLREDSCALE values
GLGREENBIAS and GLGREENSCALE
GLBLUEBIAS and GLBLUESCALE
GLALPHABIAS and GLALPHASCALE
GLDEPTHBIAS and GLDEPTHSCALE
GLINDEXOFFSET and GLINDEXSHIFT
GLMAPCOLOR and GLMAPSTENCIL enable bits
GLZOOMX and GLZOOMY factors
GLREADBUFFER setting
Post-color-matrix scale and bias values
GLCOLORTABLESCALESGI and GLCOLORTABLEBIASSGI
for all color tables
GLCONVOLUTION1DEXT,
GLCONVOLUTION2DEXT, and
GLSEPARABLE2DEXT enable bits
Convolution filter scale and bias values
Post-convolution pixel scale and bias values
Convolution border mode
GLHISTOGRAMEXT enable bit
GLMINMAXEXT enable bit
GLINTERLACESGIX enable bit
GLPOINTBIT GLPOINTSMOOTH enable bit
Point size
GLPOINTSIZEMINSGIS and GLPOINTSIZEMAXSGIS
GLPOINTFADETHRESHOLDSIZESGIS
GLDISTANCEATTENUATIONSGIS
Page 5
glPushAttrib(3G) OpenGL Reference glPushAttrib(3G)
GLPOLYGONBIT GLCULLFACE enable bit
GLCULLFACEMODE value
GLFRONTFACE indicator
GLPOLYGONMODE setting
GLPOLYGONSMOOTH enable bit
GLPOLYGONSTIPPLE enable bit
GLPOLYGONOFFSETEXT enable bit
GLPOLYGONOFFSETFACTOREXT
GLPOLYGONOFFSETBIASEXT
GLPOLYGONOFFSETFILL enable bit
GLPOLYGONOFFSETLINE enable bit
GLPOLYGONOFFSETPOINT enable bit
GLPOLYGONOFFSETFACTOR
GLPOLYGONOFFSETUNITS
GLPOLYGONSTIPPLEBIT Polygon stipple image
GLSCISSORBIT GLSCISSORTEST enable bit
Scissor box
GLSTENCILBUFFERBIT GLSTENCILTEST 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
GLTEXTUREBIT Enable bits for the four texture coordinates
Border color for each texture target
Minification function for each texture target
Magnification function for each texture target
Texture coordinates and wrap mode for each
texture target
Color, mode, and bias for each texture environment
Enable bits GLTEXTUREGENx, x is S, T, R, and Q
GLTEXTUREGENMODE setting for S, T, R, and Q
glTexGen plane equations for S, T, R, and Q
Detail texture binding, level offset, mode,
and scaling function control points
Sharp texture scaling function control points
GLTEXTURECOLORTABLESGI enable bit
GLTEXTURECOLORTABLESCALESGI
GLTEXTURECOLORTABLEBIASSGI
Current texture bindings
(e.g. GLTEXTURE2DBINDINGEXT)
Minimum and maximum LOD clamping values
Base and maximum mipmap levels
Texture filter function weights
Dual and quad texture group selection
Page 6
glPushAttrib(3G) OpenGL Reference glPushAttrib(3G)
Post-texture filter scale and bias values
Clipmap frame size, center, offset, lod offset,
depth, and virtual depth
Texture comparison operator
Texture comparison enable
Shadow ambient lighting coefficient
GLTRANSFORMBIT Coefficients of the six clipping planes
GLCLIPPLANEi enable bits
GLMATRIXMODE value
GLNORMALIZE enable bit
Coefficients of the reference plane
GLSPRITESGIX enable bit
Current sprite mode, axis, and translation
GLVIEWPORTBIT Depth range (near and far)
Viewport origin and extent
glPopAttrib restores the values of the state variables saved with the
last glPushAttrib command. Those not saved are left unchanged.
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.
Initially, the attribute stack is empty.
NOTES
Not all values for GL state can be saved on the attribute stack. For
example, pixel pack and unpack state, render mode state, and select and
feedback state cannot be saved.
The depth of the attribute stack depends on the implementation, but it
must be at least 16.
GLCOLORLOGICOP, GLINDEXLOGICOP, GLPOLYGONOFFSETFILL,
GLPOLYGONOFFSETLINE and GLPOLYGONOFFSETPOINT are only available if
the GL version is 1.1 or greater.
ERRORS
GLSTACKOVERFLOW is generated if glPushAttrib is called while the
attribute stack is full.
GLSTACKUNDERFLOW is generated if glPopAttrib is called while the
attribute stack is empty.
GLINVALIDOPERATION is generated if glPushattrib or glPopAttrib is
executed between the execution of glBegin and the corresponding execution
of glEnd.
Page 7
glPushAttrib(3G) OpenGL Reference glPushAttrib(3G)
ASSOCIATED GETS
glGet with argument GLATTRIBSTACKDEPTH.
glGet with argument GLMAXATTRIBSTACKDEPTH.
MACHINE DEPENDENCIES
GLCOLORTABLESGI, GLPOSTCOLORMATRIXCOLORTABLESGI and
GLPOSTCONVOLUTIONCOLORTABLESGI are part of the SGIcolortable
extension which is not supported on RealityEngine, RealityEngine2, and
VTX systems.
On RealityEngine, RealityEngine2, and VTX and High Impact and Maximum
Impact systems there is no support for pushing or popping attributes
related to detail texturing.
The SGIXinterlace extension is supported only on InfiniteReality
systems, on RealityEngine, RealityEngine2, and VTX systems, and on O2
systems.
RealityEngine, RealityEngine2, and VTX systems have no support for
pushing or popping attributes related to sharpen texturing.
On InfiniteReality systems, if the post-texture filter scale and bias
values are set to values other than the defaults, they are limited to the
range [0.0, 1.0). (note: this range excludes 1.0.) The
SGIXtexturescalebias extension is not supported on RealityEngine,
RealityEngine2, and VTX systems or on High Impact and Maximum Impact
systems.
The SGIStextureselect extension is supported only on InfiniteReality
systems, High Impact and Maximum Impact on Octane systems, and High
Impact and Maximum Impact on Indigo2 systems with the TRAM option card.
SEE ALSO
glGet, glGetClipPlane, glGetError, glGetLight, glGetMap, glGetMaterial,
glGetPixelMap, glGetPointerv, glGetPolygonStipple, glGetString,
glGetTexEnv, glGetTexGen, glGetTexImage, glGetTexLevelParameter,
glGetTexParameter, glIsEnabled
Page 8