GLGETQUERYOBJECT(3G)
π NAME (yes bestie, it's giving what even is this)
glGetQueryObject, glGetQueryBufferObject β these return parameters of a query object. Obsessed. π
Heads up that this page lives in section 3G of the manual, so likeβ¦ GL library docs, iykyk. πΈ
β¨ C SPECIFICATION β¨
The whole squad, verbatim, no cap:
void glGetQueryObjectiv(GLuint id, GLenum pname, GLint * params);
void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint * params);
void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 * params);
void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 * params);
void glGetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname,
GLintptr offset);
void glGetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname,
GLintptr offset);
void glGetQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname,
GLintptr offset);
void glGetQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname,
GLintptr offset);
π«Ά PARAMETERS
idβ the name of a query object. It's the main character of this whole page, lowkey. βbufferβ the name of a buffer object. Different thing, don't mix them up bestie. π¦pnameβ the symbolic name of a query object parameter. The accepted values areGL_QUERY_RESULT,GL_QUERY_RESULT_AVAILABLE,GL_QUERY_RESULT_NO_WAIT, orGL_QUERY_TARGET. That's the whole list, periodt. πparamsβ okay so this one's a two-for-one situation π: if a buffer is bound to theGL_QUERY_RESULT_BUFFERtarget, thenparamsis treated as an offset to a location within that buffer's data store to receive the result of the query. But if no buffer is bound toGL_QUERY_RESULT_BUFFER, thenparamsis treated as an address in client memory of a variable to receive the resulting data. Same name, different personality, so watch out. πoffsetβ the byte offset intobuffer's data store where the queried result will be written. π
π DESCRIPTION
So these commands return a selected parameter of the query object specified by id. glGetQueryObject returns in params a selected parameter of the query object specified by id. And glGetQueryBufferObject returns in buffer a selected parameter of the query object specified by id, by writing it to buffer's data store at the byte offset specified by offset. Slay, both of them. β¨
pname names a specific query object parameter, and pname can be as follows β the full roster, no skips:
π GL_QUERY_RESULT
params or buffer returns the value of the query object's passed samples counter. The initial value is 0. Simple, iconic.
π GL_QUERY_RESULT_NO_WAIT
If the result of the query is available (that is, a query of GL_QUERY_RESULT_AVAILABLE would return non-zero), then params or buffer returns the value of the query object's passed samples counter. Otherwise, the data referred to by params or buffer is not modified. The initial value is 0. She said "no refunds, no rewrites." π
π GL_QUERY_RESULT_AVAILABLE
params or buffer returns whether the passed samples counter is immediately available. If a delay would occur waiting for the query result, GL_FALSE is returned. Otherwise, GL_TRUE is returned β which also indicates that the results of all previous queries are available as well. Group-chat energy: if she's here, everyone before her already got here too. π₯
π GL_QUERY_TARGET
params or buffer returns the query object's target. Short and sweet. π
π NOTES
- If an error is generated, no change is made to the contents of
paramsorbuffer. Errors are a full stop, not a partial write, ngl. glGetQueryObjectandglGetQueryBufferObjectimplicitly flush the GL pipeline so that any incomplete rendering delimited by the occlusion query completes in finite time. They literally push things along so you don't wait forever. β³- If multiple queries are issued using the same query object
idbefore callingglGetQueryObjectorglGetQueryBufferObject, the results of the most recent query will be returned. And in this case, when issuing a new query, the results of the previous query are discarded. Out with the old, bestie. ποΈ glGetQueryObjecti64vandglGetQueryObjectui64vare available only if the GL version is 3.3 or greater. Gatekept, unfortunately.GL_QUERY_RESULT_NO_WAITis accepted forpnameonly if the GL version is 4.4 or greater. π- The
GL_QUERY_RESULT_BUFFERtarget is available only if the GL version is 4.4 or higher. On earlier versions of the GL,paramsis always an address in client memory β no buffer shenanigans for the old-heads. π§
π¨ ERRORS
Like, read these carefully, because every single one of them is a real vibe check you can fail.
GL_INVALID_ENUMis generated ifpnameis not an accepted value.GL_INVALID_OPERATIONis generated ifidis not the name of a query object.GL_INVALID_OPERATIONis generated byglGetQueryBufferObjectifbufferis not the name of an already created buffer object.GL_INVALID_OPERATIONis generated ifidis the name of a currently active query object. Not while she's busy, please. πGL_INVALID_OPERATIONis generated byglGetQueryObjectif a buffer is currently bound to theGL_QUERY_RESULT_BUFFERtarget and the command would cause data to be written beyond the bounds of that buffer's data store. Don't overflow, bestie. π«ΆGL_INVALID_OPERATIONis generated byglGetQueryBufferObjectif the command would cause data to be written beyond the bounds ofbuffer's data store. Same vibes, different buffer.GL_INVALID_VALUEis generated byglGetQueryBufferObjectifoffsetis negative. Negative offsets? In this economy? No ma'am. π
π VERSION SUPPORT
Okay so the original gives you a big fancy grid β the columns are OpenGL versions 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, and the rows are "Function / Feature Name." I'm giving you the exact same tea in list form so it's actually readable on your terminal. β means supported, - means nope. π
glGetQueryObjecti64vβ-on2.0,2.1,3.0,3.1;βon3.2,3.3,4.0,4.1,4.2,4.3,4.4,4.5,4.6glGetQueryObjectivββon2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4,4.5,4.6(all of them, she's been here since day one β)glGetQueryObjectui64vβ-on2.0,2.1,3.0,3.1;βon3.2,3.3,4.0,4.1,4.2,4.3,4.4,4.5,4.6glGetQueryObjectuivββon2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4,4.5,4.6glGetQueryBufferObjecti64vβ-on2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4;βon4.5,4.6glGetQueryBufferObjectivβ-on2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4;βon4.5,4.6glGetQueryBufferObjectui64vβ-on2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4;βon4.5,4.6glGetQueryBufferObjectuivβ-on2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4;βon4.5,4.6
So the BufferObject girlies are strictly 4.5/4.6 only. Late bloomers, but they ate. π₯
π¦ SEE ALSO
The whole friend group, go say hi:
glBeginQuery(),glEndQuery,glGetQueryiv(),glIsQuery(),glQueryCounter()
π COPYRIGHT
Copyright Β© 2005 Addison-Wesley. Copyright Β© 2010-2014 Khronos Group. 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/.
π COPYRIGHT (again, because there's literally a second block, and I keep every detail)
Copyright Β© 2005 Sams Publishing
Copyright Β© 2010-2014 Khronos Group
And that's the whole page, bestie β mwah π This cutie came from [FIXME: source], dated 10/07/2026, and she answers to the name GLGETQUERYOBJECT(3G). Go read your query results responsibly. ππΈβ¨
π¦ where this page comes from
- arch rolling: opengl-man-pages 20261006-1 Β· SGI-B-2.0 AND OPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms