when using ARB_occlusion_query or NV_occlusion_query i get a GL Error (Invalid Operands) at the line where the queries’ results are retrieved. I used the code example in the ARB/NV extension spec as a guideline but i cannot find anything wrong in the code.
The spec contains the conditions which result in an invalid operation. Make sure you didn’t hit one of them.
Here’s the list:
What happens if glBeginOcclusionQueryNV is called when an
occlusion query is already outstanding for a different object?
RESOLVED: This is a GL_INVALID_OPERATION error.
If BeginOcclusionQueryNV is called with an unused id, that id is
marked as used and associated with a new occlusion query object. If
it is called while another occlusion query is active, an
INVALID_OPERATION error is generated. If EndOcclusionQueryNV is
called while no occlusion query is active, an INVALID_OPERATION error
is generated. Calling either GenOCclusionQueriesNV or
DeleteOcclusionQueriesNV while an occlusion query is active causes an
INVALID_OPERATION error to be generated.
If the occlusion query object named by id is currently active, then
an INVALID_OPERATION error is generated.
Means, make sure your glGenQueries has succeeded. (Where is it?)
You might want to issue a glFlush after the final glEndOcclusionQuery to start processing immediately.
The correct way is to loop on glGetOcclusionQueryuivNV(…, GL_PIXEL_COUNT_AVAILABLE_NV, …); before querying the actual GL_PIXEL_COUNT_NV.
Other tips.
Do not call glDisable inside the for loop where you issue the occlusions, once outside is enough.
Do not use a small letter ‘L’ as variable. It’s too easy to read for ‘1’ (digit one).
What is ‘l’ in your code?
Your first for-loop is called 7 times. The last can be called eight times, if l == 0.
[This message has been edited by Relic (edited 01-12-2004).]