glIsQuery bug?

The following code always throws the assert on my machine:


If I remove the assert and go ahead and use queryId for occlusion queries, it works fine.
Am I misunderstanding glIsQuery, or is there a bug in my implementation of OpenGL / the occlusion query extensions?

The glGenQueries allocates object identifiers for the queries. The identifiers are marked as allocated for purpose of glGenQueries() however real object is not associated with any identifier until glBeginQuery is called with that identifier. This is why the glIsQuery reported that there is no such object.

And don’t use that glIs* functions, they are pointless (your app should know what is what). To be honest, all that Gen* functions are pointless too (never understood why one needs them if you can just use arbitrary numbers as object IDs).

Is there a way of checking if you are out of queries?

Your app knows what it Gen’d. But the middleware that your app uses doesn’t know.
And the System library that needs to look into your context doesn’t know.

What is “System” library? And true, Gen* “may” be useful when you are working with plugin architecture/independent libraries and have to share list space with different independent modules (but who does it, anyway?)

I wouldn`t say Gen functions are not pointless. The driver would do a better job if Gen functions were inforced.
Also, if you want portability between OpenGL and OpenGL ES, you must use Gen functions.