Light | Dark

# docs.GL

OpenGL 4
OpenGL 3
OpenGL 2
OpenGL ES 3

# glGetQueryiv

## Name

glGetQueryiv — return parameters of a query object target

## C Specification

`void glGetQueryiv(` | GLenum | target,
| GLenum | pname,
| GLint * | params`)`;

## Parameters

`target`

  Specifies a query object target. Must be `GL_SAMPLES_PASSED`.

`pname`

  Specifies the symbolic name of a query object target parameter. Accepted values are `GL_CURRENT_QUERY` or `GL_QUERY_COUNTER_BITS`.

`params`

  Returns the requested data.

## Description

`glGetQueryiv` returns in `params` a selected parameter of the query object target specified by `target`.

`pname` names a specific query object target parameter. When `target` is `GL_SAMPLES_PASSED`, `pname` can be as follows:

`GL_CURRENT_QUERY`

  `params` returns the name of the currently active occlusion query object. If no occlusion query is active, 0 is returned. The initial value is 0.

`GL_QUERY_COUNTER_BITS`

  `params` returns the number of bits in the query counter used to accumulate passing samples. If the number of bits returned is 0, the implementation does not support a query counter, and the results obtained from glGetQueryObject are useless.

## Notes

If an error is generated, no change is made to the contents of `params`.

`glGetQueryiv` is available only if the GL version is 1.5 or greater.

## Errors

`GL_INVALID_ENUM` is generated if `target` or `pname` is not an accepted value.

`GL_INVALID_OPERATION` is generated if `glGetQueryiv` is executed between the execution of glBegin and the corresponding execution of glEnd.

## See Also

glGetQueryObject, glIsQuery

## Copyright

Copyright © 2005 Addison-Wesley. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. https://opencontent.org/openpub/.

Think you can improve this page? Edit this page on GitHub.