View Full Version : How do occlusion queries account for the near clip

08-08-2011, 09:30 AM
I just had a thought; occlusion queries work by swapping out the mesh for the bounding box with the actual drawing disabled when the fragment count drops below a threshold (usually zero) and brought back if that box is seen. But what happens if the camera is inside the box at this point? (unlikely but very possible) Does the occlusion query process count fragments behind the near clip plane?

08-08-2011, 12:17 PM
The near plane should clip the geometry before any fragments are produced, just like the left or right frustum planes, so they should not be counted.

If you enable GL_ARB_depth_clamp it should work, because it disables clipping on the near and far planes.

08-08-2011, 04:44 PM