Using the Query Functions

There are four query functions for obtaining simple state variables and one for determining whether a particular state is enabled or disabled:

The prototypes for the query functions are:

void glGetBooleanv(GLenum pname , GLboolean * params );

void glGetIntegerv(GLenum pname , GLint * params );

void glGetFloatv(GLenum pname , GLfloat * params );

void glGetDoublev(GLenum pname , GLdouble * params );

Respectively, the query functions obtain Boolean, integer, floating-point, or double-precision state variables. The pname parameter is a symbolic constant indicating the state variable to return, and params is a pointer to an array of the indicated type in which to place the returned data. The possible values for pname are listed in OpenGL State Variables. A type conversion is performed if necessary to return the desired variable as the requested data type.

The prototype for glIsEnabled is:

GLboolean glIsEnabled(GLenum cap );

If the mode specified by cap is enabled, glIsEnabled returns GL_TRUE. If the mode specified by cap is disabled, glIsEnabled returns GL_FALSE. The possible values for cap are listed in OpenGL State Variables.

Other specialized functions return specific state variables. To find out when to use these functions, see OpenGL State Variables and the OpenGL Reference Manual. For more information on OpenGL's error handling facility and the glGetError function, see Error Handling.

The functions that return specific state variables are:

 

 

Show: