Function familiesfamily

glGetQueryObject*

Read a query's availability or result; pick the suffix by the size of the result.

Signature

void glGetQueryObject{iv|uiv|i64v|ui64v}(GLuint id, GLenum pname, T *params);

How it works

The four versions differ only in the type written. Use uiv for availability and sample counts, ui64v for times in nanoseconds (32 bits overflow after about 4 seconds). Reading GL_QUERY_RESULT before the GPU has produced it makes the CPU wait, so check GL_QUERY_RESULT_AVAILABLE first or read queries a few frames old.

Reading the name

uiv
32-bit unsigned: availability, sample counts.
ui64v
64-bit unsigned: GPU times and timestamps.

Functions in this family

Example

example.cpp
1GLuint ready = 0;
2glGetQueryObjectuiv(q, GL_QUERY_RESULT_AVAILABLE, &ready);
3if (ready) { GLuint64 ns; glGetQueryObjectui64v(q, GL_QUERY_RESULT, &ns); }