Sync & queriesGL 3.3
glGetQueryObjectui64v
Reads a query result as a 64-bit number: the form to use for GPU times in nanoseconds.
Part of the family glGet*, glGetQueryObject*
Signature
void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
How it works
The same as glGetQueryObjectuiv with a 64-bit result, which timer and timestamp queries need. Divide by 1e6 for milliseconds. The same rule applies: GL_QUERY_RESULT waits if the result is not ready, so read queries from a ring a few frames behind.
Parameters
idGLuint
The query.
pnameGLenum
GL_QUERY_RESULT (or _AVAILABLE, _NO_WAIT).
paramsGLuint64 *
Where the value is written.
Example
example.cpp
1// ring of N timer queries: read the one issued N-1 frames ago
2GLuint oldest = q[(frame + 1) % N];
3GLuint64 ns = 0;
4glGetQueryObjectui64v(oldest, GL_QUERY_RESULT, &ns);
5double gpuMs = ns / 1e6;