zed
09-16-2006, 03:10 AM
to clarify the result returned is the num of pixels/frags that pass the depth/stencil test
eg a model that covers just one pixel onscreen can return a figure much higher than one because the same pixel can be written to multiple times.
im writing to a 64x64 sized window thusmax number pixels covered is 4096 yet im getting sometime > 30,000 with the following
glBeginQuery( GL_SAMPLES_PASSED_ARB,ID );
draw_model();
g_rm.ogl.EndQuery( GL_SAMPLES_PASSED_ARB );
GLuint sample_count;
glGetQueryObjectuiv( ID, GL_QUERY_RESULT_ARB, &sample_count );
this sorta deminishes its worth somewhat
eg from the spec
-There are many situations where a pixel/sample count, rather than a
boolean result, is useful.
- Objects that are visible but cover only a very small number of
pixels can be skipped at a minimal reduction of image quality.
Knowing exactly how many pixels an object might cover may help the
application decide which level-of-detail model should be used. If
only a few pixels are visible, a low-detail model may be acceptable.
- Occlusion queries can replace glReadPixels of the depth buffer to
determine whether (for example) a light source is visible for the
purposes of a lens flare effect or a halo to simulate glare. Pixel
counts allow you to compute the percentage of the light source that
is visible, and the brightness of these effects can be modulated
accordingly.
eg a model that covers just one pixel onscreen can return a figure much higher than one because the same pixel can be written to multiple times.
im writing to a 64x64 sized window thusmax number pixels covered is 4096 yet im getting sometime > 30,000 with the following
glBeginQuery( GL_SAMPLES_PASSED_ARB,ID );
draw_model();
g_rm.ogl.EndQuery( GL_SAMPLES_PASSED_ARB );
GLuint sample_count;
glGetQueryObjectuiv( ID, GL_QUERY_RESULT_ARB, &sample_count );
this sorta deminishes its worth somewhat
eg from the spec
-There are many situations where a pixel/sample count, rather than a
boolean result, is useful.
- Objects that are visible but cover only a very small number of
pixels can be skipped at a minimal reduction of image quality.
Knowing exactly how many pixels an object might cover may help the
application decide which level-of-detail model should be used. If
only a few pixels are visible, a low-detail model may be acceptable.
- Occlusion queries can replace glReadPixels of the depth buffer to
determine whether (for example) a light source is visible for the
purposes of a lens flare effect or a halo to simulate glare. Pixel
counts allow you to compute the percentage of the light source that
is visible, and the brightness of these effects can be modulated
accordingly.