Sync & queriesGL 1.5

glEndQuery

Stops the active query of that target; its result will be available a little later.

Signature

void glEndQuery(GLenum target);

How it works

Note that it takes the target, not the query id: there is only one active query per target. Right after the call the result is usually not ready; check GL_QUERY_RESULT_AVAILABLE before reading it, or read a query from a few frames ago.

Parameters

targetGLenum

The same target given to glBeginQuery.

Errors

When the call is invalid it does nothing and sets an error, which glGetError returns:

GL_INVALID_OPERATION
No query of that target is active.

Example

example.cpp
1glEndQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE);
Official Khronos documentation