1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"glPushAttrib">
9 <holder>Silicon Graphics, Inc.
</holder>
12 <refentrytitle>glPushAttrib
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glPushAttrib
</refname>
17 <refpurpose>push and pop the server attribute stack
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glPushAttrib
</function></funcdef>
23 <paramdef>GLbitfield
<parameter>mask
</parameter></paramdef>
27 <refsect1 id=
"parameters"><title>Parameters
</title>
30 <term><parameter>mask
</parameter></term>
33 Specifies a mask that indicates which attributes to save. Values for
34 <parameter>mask
</parameter> are listed below.
40 <refsynopsisdiv><title>C Specification
</title>
43 <funcdef>void
<function>glPopAttrib
</function></funcdef>
44 <paramdef> <parameter>void
</parameter></paramdef>
48 <refsect1 id=
"description"><title>Description
</title>
50 <function>glPushAttrib
</function> takes one argument,
51 a mask that indicates which groups of state variables
52 to save on the attribute stack.
53 Symbolic constants are used to set bits in the mask.
54 <parameter>mask
</parameter>
55 is typically constructed by specifying the bitwise-or of several
56 of these constants together.
58 <constant>GL_ALL_ATTRIB_BITS
</constant>
59 can be used to save all stackable states.
62 The symbolic mask constants and their associated GL state are as follows
63 (the second column lists which attributes are saved):
67 <informaltable frame=
"topbot">
68 <tgroup cols=
"2" align=
"left">
74 <constant>GL_ACCUM_BUFFER_BIT
</constant>
77 Accumulation buffer clear value
82 <constant>GL_COLOR_BUFFER_BIT
</constant>
85 <constant>GL_ALPHA_TEST
</constant> enable bit
92 Alpha test function and reference value
99 <constant>GL_BLEND
</constant> enable bit
106 Blending source and destination functions
127 <constant>GL_DITHER
</constant> enable bit
134 <constant>GL_DRAW_BUFFER
</constant> setting
141 <constant>GL_COLOR_LOGIC_OP
</constant> enable bit
148 <constant>GL_INDEX_LOGIC_OP
</constant> enable bit
162 Color mode and index mode clear values
169 Color mode and index mode writemasks
174 <constant>GL_CURRENT_BIT
</constant>
191 Current normal vector
198 Current texture coordinates
205 Current raster position
212 <constant>GL_CURRENT_RASTER_POSITION_VALID
</constant> flag
219 RGBA color associated with current raster position
226 Color index associated with current raster position
233 Texture coordinates associated with current raster position
240 <constant>GL_EDGE_FLAG
</constant> flag
245 <constant>GL_DEPTH_BUFFER_BIT
</constant>
248 <constant>GL_DEPTH_TEST
</constant> enable bit
255 Depth buffer test function
262 Depth buffer clear value
269 <constant>GL_DEPTH_WRITEMASK
</constant> enable bit
274 <constant>GL_ENABLE_BIT
</constant>
277 <constant>GL_ALPHA_TEST
</constant> flag
284 <constant>GL_AUTO_NORMAL
</constant> flag
291 <constant>GL_BLEND
</constant> flag
298 Enable bits for the user-definable clipping planes
305 <constant>GL_COLOR_MATERIAL
</constant>
312 <constant>GL_CULL_FACE
</constant> flag
319 <constant>GL_DEPTH_TEST
</constant> flag
326 <constant>GL_DITHER
</constant> flag
333 <constant>GL_FOG
</constant> flag
340 <constant>GL_LIGHT
</constant><emphasis>i
</emphasis>
342 <constant>0</constant> <= <emphasis>i
</emphasis> < <constant>GL_MAX_LIGHTS
</constant>
350 <constant>GL_LIGHTING
</constant> flag
357 <constant>GL_LINE_SMOOTH
</constant> flag
364 <constant>GL_LINE_STIPPLE
</constant> flag
371 <constant>GL_COLOR_LOGIC_OP
</constant> flag
378 <constant>GL_INDEX_LOGIC_OP
</constant> flag
385 <constant>GL_MAP1_
</constant><emphasis>x
</emphasis> where
<emphasis>x
</emphasis> is a map type
392 <constant>GL_MAP2_
</constant><emphasis>x
</emphasis> where
<emphasis>x
</emphasis> is a map type
399 <constant>GL_MULTISAMPLE
</constant> flag
406 <constant>GL_NORMALIZE
</constant> flag
413 <constant>GL_POINT_SMOOTH
</constant> flag
420 <constant>GL_POLYGON_OFFSET_LINE
</constant> flag
427 <constant>GL_POLYGON_OFFSET_FILL
</constant> flag
434 <constant>GL_POLYGON_OFFSET_POINT
</constant> flag
441 <constant>GL_POLYGON_SMOOTH
</constant> flag
448 <constant>GL_POLYGON_STIPPLE
</constant> flag
455 <constant>GL_SAMPLE_ALPHA_TO_COVERAGE
</constant> flag
462 <constant>GL_SAMPLE_ALPHA_TO_ONE
</constant> flag
469 <constant>GL_SAMPLE_COVERAGE
</constant> flag
476 <constant>GL_SCISSOR_TEST
</constant> flag
483 <constant>GL_STENCIL_TEST
</constant> flag
490 <constant>GL_TEXTURE_1D
</constant> flag
497 <constant>GL_TEXTURE_2D
</constant> flag
504 <constant>GL_TEXTURE_3D
</constant> flag
511 Flags
<constant>GL_TEXTURE_GEN_
</constant><emphasis>x
</emphasis> where
<emphasis>x
</emphasis> is S, T, R, or Q
516 <constant>GL_EVAL_BIT
</constant>
519 <constant>GL_MAP1_
</constant><emphasis>x
</emphasis> enable bits, where
<emphasis>x
</emphasis> is a map type
526 <constant>GL_MAP2_
</constant><emphasis>x
</emphasis> enable bits, where
<emphasis>x
</emphasis> is a map type
533 1D grid endpoints and divisions
540 2D grid endpoints and divisions
547 <constant>GL_AUTO_NORMAL
</constant> enable bit
552 <constant>GL_FOG_BIT
</constant>
555 <constant>GL_FOG
</constant> enable bit
597 <constant>GL_FOG_MODE
</constant> value
602 <constant>GL_HINT_BIT
</constant>
605 <constant>GL_PERSPECTIVE_CORRECTION_HINT
</constant> setting
612 <constant>GL_POINT_SMOOTH_HINT
</constant> setting
619 <constant>GL_LINE_SMOOTH_HINT
</constant> setting
626 <constant>GL_POLYGON_SMOOTH_HINT
</constant> setting
633 <constant>GL_FOG_HINT
</constant> setting
640 <constant>GL_GENERATE_MIPMAP_HINT
</constant> setting
647 <constant>GL_TEXTURE_COMPRESSION_HINT
</constant> setting
652 <constant>GL_LIGHTING_BIT
</constant>
655 <constant>GL_COLOR_MATERIAL
</constant> enable bit
662 <constant>GL_COLOR_MATERIAL_FACE
</constant> value
669 Color material parameters that are tracking the current color
683 <constant>GL_LIGHT_MODEL_LOCAL_VIEWER
</constant> value
690 <constant>GL_LIGHT_MODEL_TWO_SIDE
</constant> setting
697 <constant>GL_LIGHTING
</constant> enable bit
704 Enable bit for each light
711 Ambient, diffuse, and specular intensity for each light
718 Direction, position, exponent, and cutoff angle for each light
725 Constant, linear, and quadratic attenuation factors for each light
732 Ambient, diffuse, specular, and emissive color for each material
739 Ambient, diffuse, and specular color indices for each material
746 Specular exponent for each material
753 <constant>GL_SHADE_MODEL
</constant> setting
758 <constant>GL_LINE_BIT
</constant>
761 <constant>GL_LINE_SMOOTH
</constant> flag
768 <constant>GL_LINE_STIPPLE
</constant> enable bit
775 Line stipple pattern and repeat counter
787 <constant>GL_LIST_BIT
</constant>
790 <constant>GL_LIST_BASE
</constant> setting
795 <constant>GL_MULTISAMPLE_BIT
</constant>
798 <constant>GL_MULTISAMPLE
</constant> flag
805 <constant>GL_SAMPLE_ALPHA_TO_COVERAGE
</constant> flag
812 <constant>GL_SAMPLE_ALPHA_TO_ONE
</constant> flag
819 <constant>GL_SAMPLE_COVERAGE
</constant> flag
826 <constant>GL_SAMPLE_COVERAGE_VALUE
</constant> value
833 <constant>GL_SAMPLE_COVERAGE_INVERT
</constant> value
838 <constant>GL_PIXEL_MODE_BIT
</constant>
841 <constant>GL_RED_BIAS
</constant> and
<constant>GL_RED_SCALE
</constant> settings
848 <constant>GL_GREEN_BIAS
</constant> and
<constant>GL_GREEN_SCALE
</constant> values
855 <constant>GL_BLUE_BIAS
</constant> and
<constant>GL_BLUE_SCALE
</constant>
862 <constant>GL_ALPHA_BIAS
</constant> and
<constant>GL_ALPHA_SCALE
</constant>
869 <constant>GL_DEPTH_BIAS
</constant> and
<constant>GL_DEPTH_SCALE
</constant>
876 <constant>GL_INDEX_OFFSET
</constant> and
<constant>GL_INDEX_SHIFT
</constant> values
883 <constant>GL_MAP_COLOR
</constant> and
<constant>GL_MAP_STENCIL
</constant> flags
890 <constant>GL_ZOOM_X
</constant> and
<constant>GL_ZOOM_Y
</constant> factors
897 <constant>GL_READ_BUFFER
</constant> setting
902 <constant>GL_POINT_BIT
</constant>
905 <constant>GL_POINT_SMOOTH
</constant> flag
917 <constant>GL_POLYGON_BIT
</constant>
920 <constant>GL_CULL_FACE
</constant> enable bit
927 <constant>GL_CULL_FACE_MODE
</constant> value
934 <constant>GL_FRONT_FACE
</constant> indicator
941 <constant>GL_POLYGON_MODE
</constant> setting
948 <constant>GL_POLYGON_SMOOTH
</constant> flag
955 <constant>GL_POLYGON_STIPPLE
</constant> enable bit
962 <constant>GL_POLYGON_OFFSET_FILL
</constant> flag
969 <constant>GL_POLYGON_OFFSET_LINE
</constant> flag
976 <constant>GL_POLYGON_OFFSET_POINT
</constant> flag
983 <constant>GL_POLYGON_OFFSET_FACTOR
</constant>
990 <constant>GL_POLYGON_OFFSET_UNITS
</constant>
995 <constant>GL_POLYGON_STIPPLE_BIT
</constant>
998 Polygon stipple image
1002 <entry align=
"left">
1003 <constant>GL_SCISSOR_BIT
</constant>
1005 <entry align=
"left">
1006 <constant>GL_SCISSOR_TEST
</constant> flag
1010 <entry align=
"left">
1012 <entry align=
"left">
1017 <entry align=
"left">
1018 <constant>GL_STENCIL_BUFFER_BIT
</constant>
1020 <entry align=
"left">
1021 <constant>GL_STENCIL_TEST
</constant> enable bit
1025 <entry align=
"left">
1027 <entry align=
"left">
1028 Stencil function and reference value
1032 <entry align=
"left">
1034 <entry align=
"left">
1039 <entry align=
"left">
1041 <entry align=
"left">
1042 Stencil fail, pass, and depth buffer pass actions
1046 <entry align=
"left">
1048 <entry align=
"left">
1049 Stencil buffer clear value
1053 <entry align=
"left">
1055 <entry align=
"left">
1056 Stencil buffer writemask
1060 <entry align=
"left">
1061 <constant>GL_TEXTURE_BIT
</constant>
1063 <entry align=
"left">
1064 Enable bits for the four texture coordinates
1068 <entry align=
"left">
1070 <entry align=
"left">
1071 Border color for each texture image
1075 <entry align=
"left">
1077 <entry align=
"left">
1078 Minification function for each texture image
1082 <entry align=
"left">
1084 <entry align=
"left">
1085 Magnification function for each texture image
1089 <entry align=
"left">
1091 <entry align=
"left">
1092 Texture coordinates and wrap mode for each texture image
1096 <entry align=
"left">
1098 <entry align=
"left">
1099 Color and mode for each texture environment
1103 <entry align=
"left">
1105 <entry align=
"left">
1106 Enable bits
<constant>GL_TEXTURE_GEN_
</constant><emphasis>x
</emphasis>,
<emphasis>x
</emphasis> is S, T, R, and Q
1110 <entry align=
"left">
1112 <entry align=
"left">
1113 <constant>GL_TEXTURE_GEN_MODE
</constant> setting for S, T, R, and Q
1117 <entry align=
"left">
1119 <entry align=
"left">
1120 <citerefentry><refentrytitle>glTexGen
</refentrytitle></citerefentry> plane equations for S, T, R, and Q
1124 <entry align=
"left">
1126 <entry align=
"left">
1127 Current texture bindings (for example,
<constant>GL_TEXTURE_BINDING_2D
</constant>)
1131 <entry align=
"left">
1132 <constant>GL_TRANSFORM_BIT
</constant>
1134 <entry align=
"left">
1135 Coefficients of the six clipping planes
1139 <entry align=
"left">
1141 <entry align=
"left">
1142 Enable bits for the user-definable clipping planes
1146 <entry align=
"left">
1148 <entry align=
"left">
1149 <constant>GL_MATRIX_MODE
</constant> value
1153 <entry align=
"left">
1155 <entry align=
"left">
1156 <constant>GL_NORMALIZE
</constant> flag
1160 <entry align=
"left">
1162 <entry align=
"left">
1163 <constant>GL_RESCALE_NORMAL
</constant> flag
1167 <entry align=
"left">
1168 <constant>GL_VIEWPORT_BIT
</constant>
1170 <entry align=
"left">
1171 Depth range (near and far)
1175 <entry align=
"left">
1177 <entry align=
"left">
1178 Viewport origin and extent
1185 <citerefentry><refentrytitle>glPopAttrib
</refentrytitle></citerefentry> restores the values of the state variables saved with the last
1186 <function>glPushAttrib
</function> command.
1187 Those not saved are left unchanged.
1190 It is an error to push attributes onto a full stack
1191 or to pop attributes off an empty stack.
1192 In either case, the error flag is set
1193 and no other change is made to GL state.
1196 Initially, the attribute stack is empty.
1199 <refsect1 id=
"notes"><title>Notes
</title>
1201 Not all values for GL state can be saved on the attribute stack.
1204 and select and feedback state cannot be saved.
1205 Client state must be saved with
1206 <citerefentry><refentrytitle>glPushClientAttrib
</refentrytitle></citerefentry>.
1209 The depth of the attribute stack depends on the implementation,
1210 but it must be at least
16.
1213 For OpenGL versions
1.3 and greater, or when the
<code>ARB_multitexture
</code> extension is supported, pushing and
1214 popping texture state applies to all supported texture units.
1217 <refsect1 id=
"errors"><title>Errors
</title>
1219 <constant>GL_STACK_OVERFLOW
</constant> is generated if
<function>glPushAttrib
</function> is called while
1220 the attribute stack is full.
1223 <constant>GL_STACK_UNDERFLOW
</constant> is generated if
<citerefentry><refentrytitle>glPopAttrib
</refentrytitle></citerefentry> is called while
1224 the attribute stack is empty.
1227 <constant>GL_INVALID_OPERATION
</constant> is generated if
<function>glPushAttrib
</function> or
<citerefentry><refentrytitle>glPopAttrib
</refentrytitle></citerefentry>
1228 is executed between the execution of
<citerefentry><refentrytitle>glBegin
</refentrytitle></citerefentry>
1229 and the corresponding execution of
<citerefentry><refentrytitle>glEnd
</refentrytitle></citerefentry>.
1232 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
1234 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_ATTRIB_STACK_DEPTH
</constant>
1237 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_MAX_ATTRIB_STACK_DEPTH
</constant>
1240 <refsect1 id=
"seealso"><title>See Also
</title>
1242 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry>,
1243 <citerefentry><refentrytitle>glGetClipPlane
</refentrytitle></citerefentry>,
1244 <citerefentry><refentrytitle>glGetError
</refentrytitle></citerefentry>,
1245 <citerefentry><refentrytitle>glGetLight
</refentrytitle></citerefentry>,
1246 <citerefentry><refentrytitle>glGetMap
</refentrytitle></citerefentry>,
1247 <citerefentry><refentrytitle>glGetMaterial
</refentrytitle></citerefentry>,
1248 <citerefentry><refentrytitle>glGetPixelMap
</refentrytitle></citerefentry>,
1249 <citerefentry><refentrytitle>glGetPolygonStipple
</refentrytitle></citerefentry>,
1250 <citerefentry><refentrytitle>glGetString
</refentrytitle></citerefentry>,
1251 <citerefentry><refentrytitle>glGetTexEnv
</refentrytitle></citerefentry>,
1252 <citerefentry><refentrytitle>glGetTexGen
</refentrytitle></citerefentry>,
1253 <citerefentry><refentrytitle>glGetTexImage
</refentrytitle></citerefentry>,
1254 <citerefentry><refentrytitle>glGetTexLevelParameter
</refentrytitle></citerefentry>,
1255 <citerefentry><refentrytitle>glGetTexParameter
</refentrytitle></citerefentry>,
1256 <citerefentry><refentrytitle>glIsEnabled
</refentrytitle></citerefentry>,
1257 <citerefentry><refentrytitle>glPushClientAttrib
</refentrytitle></citerefentry>
1260 <refsect1 id=
"Copyright"><title>Copyright
</title>
1262 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
1263 Silicon Graphics, Inc. This document is licensed under the SGI
1264 Free Software B License. For details, see
1265 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.