Occlusion query with depth disabled pass

If i disable depth buffer test and render a quad with occlusion query i get 100% NON-occluded geometry. If i enable the depth buffer again i get other values depending on the depth buffer information before the quad which is occluded. Can’t find in the specs if this is correct since the depth buffer is disabled and not set to GL_ALWAYS or any other value allowing to pass the depth test. Is the behavior correct that on disabled depth test the number of passed pixels is always 100%?
Note: Using standard OpenGL glBeginQuery, glEndQuery functions.

from :

If depth testing is disabled or if no depth buffer exists, it is as if the depth test always passes.

I guess you need for your code to disable writing via the depth-mask and color-mask.

i was looking in the wrong place. remembered, thanks alot.

Note that on some cards (ATI mostly IIRC) the results from occlusion tests are not entirely correct / deterministic.

When i made some lens-flare effect, it worked perfectly on one card, and it was flickering all the time on another card. Looking at the values the occlusion query returned two very different values randomly each frame, although the occlusion didn’t change.

Other people confirmed, that they had the same problem.

I don’t know whether that still happens today, i only use occlusion queries for “all or nothing” tests these days.


thats valueable info Jan, thanks.