Vexator
08-03-2006, 04:31 AM
i'm still having some trouble with occlusion queries using 'GL_ARB_occlusion_query'. they work fine in general, but sometimes some meshes still seem to be drawn although they are occluded and some others are not rendered although they are visible. i guess this is because not all results are available yet. so i read the spec which suggests the following to check if the results are available yet:
i = N*3/4; // instead of N-1, to prevent the GPU from going idle
do {
DoSomeStuff();
glGetQueryObjectivARB(queries[i], GL_QUERY_RESULT_AVAILABLE_ARB, &available);
} while (!available);first of all, 'available' has to be an integer.. so what should it return? 1 if the result is available, 0 otherwise?
i added it to my code, compiled and ran my app, however, it kept freezing, probably because of an infinite loop..
so instead i just placed the occlusion queries at the end of every frame hoping that the results will always be available in the next frame - this works in most cases, but still not 100%.
ideas?
ah another question - sometimes the result is bigger than the total pixels on the screen, i.e. result > width x height.. how is this possible?
and why are occlusion queries asynchronously at all?
i = N*3/4; // instead of N-1, to prevent the GPU from going idle
do {
DoSomeStuff();
glGetQueryObjectivARB(queries[i], GL_QUERY_RESULT_AVAILABLE_ARB, &available);
} while (!available);first of all, 'available' has to be an integer.. so what should it return? 1 if the result is available, 0 otherwise?
i added it to my code, compiled and ran my app, however, it kept freezing, probably because of an infinite loop..
so instead i just placed the occlusion queries at the end of every frame hoping that the results will always be available in the next frame - this works in most cases, but still not 100%.
ideas?
ah another question - sometimes the result is bigger than the total pixels on the screen, i.e. result > width x height.. how is this possible?
and why are occlusion queries asynchronously at all?