Tuesday, May 31, 2011

glGetIntegerv example c c++ java objc

Name

glGetIntegerv - return the value or values of a selected parameter

C Specification

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

glGetIntegerv returns 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 integer in which to place the returned data.
The following symbolic constants are accepted by pname:
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_BLUE_BITS
params returns one value, the number of blue bitplanes in the color buffer.
GL_COMPRESSED_TEXTURE_FORMATS
params returns GL_NUM_COMPRESSED_TEXTURE_FORMATS values, the supported compressed texture formats. See glCompressedTexImage2D and glCompressedTexSubImage2D.
(glGetIntegerv)
GL_DEPTH_BITS
params returns one value, the number of bitplanes in the depth buffer.
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_MAX_ELEMENTS_INDICES
params returns one value, the recommended maximum number of vertex array indices. See glDrawElements.
GL_MAX_ELEMENTS_VERTICES
params returns one value, the recommended maximum number of vertex array vertices. See glDrawArrays and glDrawElements.
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.
(glGetIntegerv)
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_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_RED_BITS
params returns one value, the number of red bitplanes in each color buffer.
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_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.

Errors

GL_INVALID_ENUM is generated if pname is not an accepted value.

Copyright

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

See Also

glGetError, glGetString


Example of glGetIntegerv
-------------------------------------------------------------------------
GLint viewport[4];
GLdouble mvmatrix[16], projmatrix[16];
GLint realY;
glGetIntegerv(GL_VIEWPORT,viewport);
glGetDoublev(GL_MODELVIEW_MATRIX,mvmatrix);
glGetDoublev(GL_PROJECTION_MATRIX,projmatrix);
realY = viewport[3] - screenY;
GLfloat winZ;
glReadPixels(screenX, realY, 1,1,GL_DEPTH_COMPONENT,GL_FLOAT,&winZ);
return gluUnProject((GLdouble)screenX,(GLdouble)realY, (GLdouble)winZ, mvmatrix,projmatrix,viewport, &wx,&wy,&wz);