Name

glGet — return the value or values of a selected parameter

C Specification

void glGetBooleanv(GLenum pname,
 GLboolean * params);
 
void glGetFixedv(GLenum pname,
 GLfixed * params);
 
void glGetFloatv(GLenum pname,
 GLfloat * params);
 
void glGetIntegerv(GLenum pname,
 GLint * params);
 

Parameters

pname

Specifies the parameter value to be returned. The symbolic constants in the list below are accepted.

params

Returns the value or values of the specified parameter.

Description

These commands return values for static state variables in GL. pname is a symbolic constant indicating the static state variable to be returned, and params is a pointer to an array of the indicated type in which to place the returned data.

If a Get command is issued that returns value types different from the type of the value being obtained, a type conversion is performed. If GetBooleanv is called, a floating-point or integer value converts to GL_FALSE if and only if it is zero (otherwise it converts to GL_TRUE). If GetIntegerv is called, a boolean value is interpreted as either 1 or 0, and a floating-point value is rounded to the nearest integer, unless the value is an RGBA color component, a DepthRange value, a depth buffer clear value, or a normal coordinate. In these cases, the Get command does a linear mapping that maps 1.0 to the most positive representable integer value, and -1.0 to the most negative representable integer value. If GetFloatv is called, a boolean value is interpreted as either 1.0 or 0.0, an integer is coerced to floating-point. If a value is so large in magnitude that it cannot be represented with the requested type, then the nearest value representable using the requested type is returned.

The following symbolic constants are accepted by pname:

GL_ACTIVE_TEXTURE

params returns a single value indicating the active multitexture unit. The initial value is GL_TEXTURE0. See glActiveTexture.

GL_ALIASED_POINT_SIZE_RANGE

params returns two values, the smallest and largest supported sizes for aliased points. The range must include 1. See glPointSize.

GL_ALIASED_LINE_WIDTH_RANGE

params returns two values, the smallest and largest supported widths for aliased lines. The range must include 1. See glLineWidth.

GL_ALPHA_BITS

params returns one value, the number of alpha bitplanes in the color buffer.

GL_ALPHA_TEST

params returns a single boolean value indicating whether alpha testing of fragments is enabled. The initial value is GL_FALSE. See glAlphaFunc.

GL_ALPHA_TEST_FUNC

params returns one value, the symbolic name of the alpha test function. See glAlphaFunc.

GL_ALPHA_TEST_REF

params returns one value, the reference value for the alpha test. An integer value, if requested, is linearly mapped from the internal floating-point representation such that 1.0 returns the most positive representable integer value, and -1.0 returns the most negative representable integer value. See glAlphaFunc.

GL_ARRAY_BUFFER_BINDING

params returns a single value, the name of the buffer object currently bound to the target GL_ARRAY_BUFFER. If no buffer object is bound to this target, 0 is returned. The initial value is 0. See glBindBuffer.

GL_BLEND

params returns a single boolean value indicating whether blending of fragments is enabled. The initial value is GL_FALSE. See glBlendFunc and glLogicOp.

GL_BLEND_DST

params returns one value, the symbolic constant identifying the destination blend function. See glBlendFunc.

GL_BLEND_SRC

params returns one value, the symbolic constant identifying the source blend function. See glBlendFunc.

GL_BLUE_BITS

params returns one value, the number of blue bitplanes in the color buffer.

GL_CLIENT_ACTIVE_TEXTURE

params returns a single value indicating the current client active multitexture unit. The initial value is GL_TEXTURE0. See glClientActiveTexture.

GL_CLIP_PLANEi

params returns a single boolean value indicating whether the ith user clipping plane is enabled. The initial value is GL_FALSE. See glClipPlane.

GL_COLOR_ARRAY

params returns a single boolean value indicating whether the color array is enabled. The initial value is GL_FALSE. See glColorPointer.

GL_COLOR_ARRAY_BUFFER_BINDING

params returns one value, the color array buffer binding. See glColorPointer.

GL_COLOR_ARRAY_SIZE

params returns one value, the number of components per color in the color array. See glColorPointer.

GL_COLOR_ARRAY_STRIDE

params returns one value, the byte offset between consecutive colors in the color array. See glColorPointer.

GL_COLOR_ARRAY_TYPE

params returns one value, returns the data type of each component in the color array. See glColorPointer.

GL_COLOR_CLEAR_VALUE

params returns four values: the red, green, blue, and alpha values used to clear the color buffers. See glClearColor.

GL_COLOR_LOGIC_OP

params returns a single boolean value indicating whether logical operation on color values is enabled. The initial value is GL_FALSE. See glLogicOp.

GL_COLOR_MATERIAL

params returns a single boolean value indicating whether color material tracking is enabled. The initial value is GL_FALSE. See glMaterial.

GL_COLOR_WRITEMASK

params returns four boolean values: the red, green, blue, and alpha write enables for the color buffers. See glColorMask.

GL_COMPRESSED_TEXTURE_FORMATS

params returns GL_NUM_COMPRESSED_TEXTURE_FORMATS values, the supported compressed texture formats. See glCompressedTexImage2D and glCompressedTexSubImage2D.

GL_CULL_FACE

params returns a single boolean value indicating whether polygon culling is enabled. The initial value is GL_FALSE. See glCullFace.

GL_CULL_FACE_MODE

params returns one value, a symbolic constant indicating which polygon faces are to be culled. The initial value is GL_BACK. See glCullFace.

GL_CURRENT_COLOR

params returns four values: the red, green, blue, and alpha values of the current color. Integer values, if requested, are linearly mapped from the internal floating-point representation such that 1.0 returns the most positive representable integer value, and -1.0 returns the most negative representable integer value. The initial value is (1, 1, 1, 1). See glColor.

GL_CURRENT_NORMAL

params returns three values: the x, y, and z values of the current normal. Integer values, if requested, are linearly mapped from the internal floating-point representation such that 1.0 returns the most positive representable integer value, and -1.0 returns the most negative representable integer value. The initial value is (0, 0, 1). See glNormal.

GL_CURRENT_TEXTURE_COORDS

params returns four values: the s, t, r, and q current texture coordinates. The initial value is (0, 0, 0, 1). See glMultiTexCoord.

GL_DEPTH_BITS

params returns one value, the number of bitplanes in the depth buffer.

GL_DEPTH_CLEAR_VALUE

params returns one value, the value that is used to clear the depth buffer. See glClearDepth.

GL_DEPTH_FUNC

params returns one value, the symbolic name of the depth comparision function. See glDepthFunc.

GL_DEPTH_RANGE

params returns two values: the near and far mapping limits for the depth buffer. See glDepthRange.

GL_DEPTH_TEST

params returns a single boolean value indicating whether depth testing of fragments is enabled. The initial value is GL_FALSE. See glDepthFunc and glDepthRange.

GL_DEPTH_WRITEMASK

params returns a single boolean value indicating if the depth buffer is enabled for writing. See glDepthMask.

GL_ELEMENT_ARRAY_BUFFER_BINDING

params returns a single value, the name of the buffer object currently bound to the target GL_ELEMENT_ARRAY_BUFFER. If no buffer object is bound to this target, 0 is returned. The initial value is 0. See glBindBuffer.

GL_FOG

params returns a single boolean value indicating whether fog is enabled. The initial value is GL_FALSE. See glFog.

GL_FOG_COLOR

params returns four values: the red, green, blue, and alpha components of the fog color. See glFog.

GL_FOG_DENSITY

params returns one value, the fog density parameter. See glFog.

GL_FOG_END

params returns one value, the end factor for the linear fog equation. See glFog.

GL_FOG_HINT

params returns one value, a symbolic constant indicating the mode of the fog hint. See glHint.

GL_FOG_MODE

params returns one value, a symbolic constant indicating which fog equation is selected. See glFog.

GL_FOG_START

params returns one value, the start factor for the linear fog equation. See glFog.

GL_FRONT_FACE

params returns one value, a symbolic constant indicating whether clockwise or counterclockwise polygon winding is treated as front-facing. See glFrontFace.

GL_GREEN_BITS

params returns one value, the number of green bitplanes in the color buffer.

GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES

params returns one value, the preferred format for pixel read back. See glReadPixels.

GL_IMPLEMENTATION_COLOR_READ_TYPE_OES

params returns one value, the preferred type for pixel read back. See glReadPixels.

GL_LIGHT_MODEL_AMBIENT

params returns four values: the red, green, blue, and alpha components of the ambient intensity of the entire scene. See glLightModel.

GL_LIGHT_MODEL_TWO_SIDE

params returns a single boolean value indicating whether separate materials are used to compute lighting for front and back facing polygons. See glLightModel.

GL_LIGHTi

params returns a single boolean value indicating whether the ith light is enabled. The initial value is GL_FALSE. See glLight and glLightModel.

GL_LIGHTING

params returns a single boolean value indicating whether lighting is enabled. The initial value is GL_FALSE. See glLight, glLightModel, and glMaterial.

GL_LINE_SMOOTH

params returns a single boolean value indicating whether line antialiasing is enabled. The initial value is GL_FALSE. See glLineWidth.

GL_LINE_SMOOTH_HINT

params returns one value, a symbolic constant indicating the mode of the line antialiasing hint. See glHint.

GL_LINE_WIDTH

params returns one value, the line width as specified with glLineWidth.

GL_LOGIC_OP_MODE

params returns one value, a symbolic constant indicating the selected logic operation mode. See glLogicOp.

GL_MATRIX_MODE

params returns one value, a symbolic constant indicating which matrix stack is currently the target of all matrix operations. See glMatrixMode.

GL_MAX_CLIP_PLANES

params returns one value, the maximum number of application defined clipping planes. The value must be at least 6. See glClipPlane.

GL_MAX_LIGHTS

params returns one value, the maximum number of lights. The value must be at least 8. See glLight.

GL_MAX_MODELVIEW_STACK_DEPTH

params returns one value, the maximum supported depth of the modelview matrix stack. The value must be at least 16. See glPushMatrix.

GL_MAX_PROJECTION_STACK_DEPTH

params returns one value, the maximum supported depth of the projection matrix stack. The value must be at least 2. See glPushMatrix.

GL_MAX_TEXTURE_SIZE

params returns one value. The value gives a rough estimate of the largest texture that the GL can handle. The value must be at least 64. See glTexImage2D, glCompressedTexImage2D, and glCopyTexImage2D.

GL_MAX_TEXTURE_STACK_DEPTH

params returns one value, the maximum supported depth of the texture matrix stack. The value must be at least 2. See glPushMatrix.

GL_MAX_TEXTURE_UNITS

params returns a single value indicating the number of texture units supported. The value must be at least 1. See glActiveTexture, glClientActiveTexture and glMultiTexCoord.

GL_MAX_VIEWPORT_DIMS

params returns two values: the maximum supported width and height of the viewport. These must be at least as large as the visible dimensions of the display being rendered to. See glViewport.

GL_MODELVIEW_MATRIX

params returns sixteen values: the modelview matrix on the top of the modelview matrix stack. See glPushMatrix.

GL_MODELVIEW_STACK_DEPTH

params returns one value, the number of matrices on the modelview matrix stack. See glPushMatrix.

GL_MULTISAMPLE

params returns a single boolean value indicating whether multisampling is enabled. The initial value is GL_TRUE.

GL_NORMAL_ARRAY

params returns a single boolean value indicating whether the normal array is enabled. The initial value is GL_FALSE. See glNormalPointer.

GL_NORMAL_ARRAY_BUFFER_BINDING

params returns one value, the normal array buffer binding. See glNormalPointer.

GL_NORMAL_ARRAY_STRIDE

params returns one value, the byte offset between consective normals in the normal array. See glNormalPointer.

GL_NORMAL_ARRAY_TYPE

params returns one value, the data type of each normal in the normal array. See glNormalPointer.

GL_NORMALIZE

params returns a single boolean value indicating whether normalization of normals is enabled. The initial value is GL_FALSE. See glNormal.

GL_NUM_COMPRESSED_TEXTURE_FORMATS

params returns one value, the number of supportex compressed texture formats. The value must be at least 10. See glCompressedTexImage2D and glCompressedTexSubImage2D.

GL_PACK_ALIGNMENT

params returns one value, the byte alignment used for writing pixel data to memory. See glPixelStorei.

GL_PERSPECTIVE_CORRECTION_HINT

params returns one value, a symbolic constant indicating the mode of the perspective correction hint. See glHint.

GL_POINT_DISTANCE_ATTENUATION

params returns three values, the distance attenuation function coefficients a, b, and c. The initial value is (1, 0, 0). See glPointParameter.

GL_POINT_FADE_THRESHOLD_SIZE

params returns one value, the point fade threshold. The initial value is 1. See glPointParameter.

GL_POINT_SIZE

params returns one value, the point size as specified by glPointSize.

GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES

params returns one value, the point size array buffer binding. See glPointSizePointerOES.

GL_POINT_SIZE_ARRAY_OES

params returns a single boolean value indicating whether the point size array is enabled. The initial value is GL_FALSE. See glPointSizePointerOES.

GL_POINT_SIZE_ARRAY_STRIDE_OES

params returns one value, the byte offset between consecutive point sizes in the point size array. See glPointSizePointerOES.

GL_POINT_SIZE_ARRAY_TYPE_OES

params returns one value, the data type of each point size in the point array. See glPointSizePointerOES.

GL_POINT_SIZE_MAX

params returns one value, the upper bound to which the derived point size is clamped. The initial value is the maximum of the implementation dependent max aliased and smooth point sizes. See glPointParameter.

GL_POINT_SIZE_MIN

params returns one value, the lower bound to which the derived point size is clamped. The initial value is 0. See glPointParameter.

GL_POINT_SMOOTH

params returns a single boolean value indicating whether point antialiasing is enabled. The initial value is GL_FALSE. See glPointSize.

GL_POINT_SMOOTH_HINT

params returns one value, a symbolic constant indicating the mode of the point antialiasing hint. See glHint.

GL_POINT_SPRITE_OES

params returns a single boolean value indicating whether point sprites are enabled. The initial value is GL_FALSE. See glTexEnv.

GL_POLYGON_OFFSET_FACTOR

params returns one value, the scaling factor used to determine the variable offset that is added to the depth value of each fragment generated when a polygon is rasterized. See glPolygonOffset.

GL_POLYGON_OFFSET_FILL

params returns a single boolean value indicating whether polygon offset is enabled for polygons in fill mode. The initial value is GL_FALSE. See glPolygonOffset.

GL_POLYGON_OFFSET_UNITS

params returns one value. This value is multiplied by an implementation-specific value and then added to the depth value of each fragment generated when a polygon is rasterized. See glPolygonOffset.

GL_PROJECTION_MATRIX

params returns sixteen values: the projection matrix on the top of the projection matrix stack. See glPushMatrix.

GL_PROJECTION_STACK_DEPTH

params returns one value, the number of matrices on the projection matrix stack. See glPushMatrix.

GL_RED_BITS

params returns one value, the number of red bitplanes in each color buffer.

GL_RESCALE_NORMAL

params returns a single boolean value indicating whether rescaling of normals is enabled. The initial value is GL_FALSE. See glNormal.

GL_SAMPLE_ALPHA_TO_COVERAGE

params returns a single boolean value indicating if the fragment coverage value should be ANDed with a temporary coverage value based on the fragment's alpha value. The initial value is GL_FALSE. See glSampleCoverage.

GL_SAMPLE_ALPHA_TO_ONE

params returns a single boolean value indicating if the fragment's alpha value should be replaced by the maximum representable alpha value after coverage determination. The initial value is GL_FALSE. See glSampleCoverage.

GL_SAMPLE_BUFFERS

params returns a single integer value indicating the number of sample buffers associated with the currently bound framebuffer. See glSampleCoverage.

GL_SAMPLE_COVERAGE

params returns a single boolean value indicating if the fragment coverage value should be ANDed with a temporary coverage value based on the current sample coverage value. The initial value is GL_FALSE. See glSampleCoverage.

GL_SAMPLE_COVERAGE_INVERT

params returns a single boolean value indicating if the temporary coverage value should be inverted. See glSampleCoverage.

GL_SAMPLE_COVERAGE_VALUE

params returns a single positive floating-point value indicating the current sample coverage value. See glSampleCoverage.

GL_SAMPLES

params returns a single integer value indicating the coverage mask size of the currently bound framebuffer. See glSampleCoverage.

GL_SCISSOR_BOX

params returns four values: the x and y window coordinates of the scissor box, followed by its width and height. See glScissor.

GL_SCISSOR_TEST

params returns a single boolean value indicating whether scissoring is enabled. The initial value is GL_FALSE. See glScissor.

GL_SHADE_MODEL

params returns one value, a symbolic constant indicating whether the shading mode is flat or smooth. See glShadeModel.

GL_SMOOTH_LINE_WIDTH_RANGE

params returns two values, the smallest and largest supported widths for antialiased lines. The range must include 1. See glLineWidth.

GL_SMOOTH_POINT_SIZE_RANGE

params returns two values, the smallest and largest supported widths for antialiased points. The range must include 1. See glPointSize.

GL_STENCIL_BITS

params returns one value, the number of bitplanes in the stencil buffer.

GL_STENCIL_CLEAR_VALUE

params returns one value, the index to which the stencil bitplanes are cleared. See glClearStencil.

GL_STENCIL_FAIL

params returns one value, a symbolic constant indicating what action is taken when the stencil test fails. See glStencilOp.

GL_STENCIL_FUNC

params returns one value, a symbolic constant indicating what function is used to compare the stencil reference value with the stencil buffer value. See glStencilFunc.

GL_STENCIL_PASS_DEPTH_FAIL

params returns one value, a symbolic constant indicating what action is taken when the stencil test passes, but the depth test fails. See glStencilOp.

GL_STENCIL_PASS_DEPTH_PASS

params returns one value, a symbolic constant indicating what action is taken when the stencil test passes, and the depth test passes. See glStencilOp.

GL_STENCIL_REF

params returns one value, the reference value that is compared with the contents of the stencil buffer. See glStencilFunc.

GL_STENCIL_TEST

params returns a single boolean value indicating whether stencil testing of fragments is enabled. The initial value is GL_FALSE. See glStencilFunc and glStencilOp.

GL_STENCIL_VALUE_MASK

params returns one value, the mask that is used to mask both the stencil reference value and the stencil buffer value before they are compared. See glStencilFunc.

GL_STENCIL_WRITEMASK

params returns one value, the mask that controls writing of the stencil bitplanes. See glStencilMask.

GL_SUBPIXEL_BITS

params returns one value, an estimate of the number of bits of subpixel resolution that are used to position rasterized geometry in window coordinates. The value must be at least 4.

GL_TEXTURE_2D

params returns a single boolean value indicating whether 2D texturing is enabled. The initial value is GL_FALSE. See glTexImage2D.

GL_TEXTURE_BINDING_2D

params returns one value, the name of the texture currently bound to the target GL_TEXTURE_2D. See glBindTexture.

GL_TEXTURE_COORD_ARRAY

params returns a single boolean value indicating whether the texture coordinate array is enabled. The initial value is GL_FALSE. See glTexCoordPointer.

GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING

params returns one value, the texture coordinate array buffer binding. See glTexCoordPointer.

GL_TEXTURE_COORD_ARRAY_SIZE

params returns one value, the number of coordinates per element in the texture coordinate array. See glTexCoordPointer.

GL_TEXTURE_COORD_ARRAY_STRIDE

params returns one value, the byte offset between consecutive elements in the texture coordinate array. See glTexCoordPointer.

GL_TEXTURE_COORD_ARRAY_TYPE

params returns one value, returns the data type of each coordinate in the texture coordinate array. See glTexCoordPointer.

GL_TEXTURE_MATRIX

params returns sixteen values: the texture matrix on the top of the texture matrix stack. See glPushMatrix.

GL_TEXTURE_STACK_DEPTH

params returns one value, the number of matrices on the texture matrix stack. See glBindTexture.

GL_UNPACK_ALIGNMENT

params returns one value, the byte alignment used for reading pixel data from memory. See glPixelStorei.

GL_VIEWPORT

params returns four values:, the x and y window coordinates of the viewport, followed by its width and height. See glViewport.

GL_VERTEX_ARRAY

params returns a single boolean value indicating whether the vertex array is enabled. The initial value is GL_FALSE. See glVertexPointer.

GL_VERTEX_ARRAY_BUFFER_BINDING

params returns one value, the vertex array buffer binding. See glVertexPointer.

GL_VERTEX_ARRAY_SIZE

params returns one value, number of coordinates per vertex in the vertex array. See glVertexPointer.

GL_VERTEX_ARRAY_STRIDE

params returns one value, the byte offset between consecutive vertexes in the vertex array. See glVertexPointer.

GL_VERTEX_ARRAY_TYPE

params returns one value, returns the data type of each coordinate in the vertex array. See glVertexPointer.

Notes

GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES, GL_POINT_SIZE_ARRAY_STRIDE_OES, and GL_POINT_SIZE_ARRAY_TYPE_OES are only accepted if the OpenGL ES version number is 1.1 or greater.

Errors

GL_INVALID_ENUM is generated if pname is not an accepted value.

See Also

glGetError, glGetString

Copyright

Copyright © 2003-2004 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.