View Full Version : GL_SAMPLE_POSITION return null values

05-11-2011, 04:22 AM

i'm succesfully using GL_ARB_texture_multisample extension. Anyway, when i try to query for GL_SAMPLE_POSITION, i get always zeros. My graphic card is a Nvidia Shader Model 4.0.

Here is the code:

GLfloat pos[64];
int query = 0;
memset( pos, 0, 64 * sizeof( float ) );

glGetTexLevelParameteriv( GL_TEXTURE_2D_MULTISAMPLE, 0, GL_TEXTURE_SAMPLES, &query );

for( GLuint i = 0; i < query; i++ )
glGetMultisamplefv( GL_SAMPLE_POSITION, i, &amp;pos[i*2] );

05-15-2011, 06:39 AM
Help :) !

Anyway I know that the position is express like (x,y) position. The range is between (0.0, 0.0 ) .. ( 1.0, 1.0 ) with (0.5,0.5) as pixel center.
My question: Wich is the extent of the sample positions? Are they always inside the physical dimension of the pixel? If not, could you modify it and how ?

05-15-2011, 07:31 AM
As far as i can remember this call (glGetMultisamplefv) operates on current draw framebuffer, so you need to setup an fbo with this texture.

Yes, sample positions will always be inside the pixel (as you said yourself, sample position is 0 - 1).

Also, no you cant modify them in any way. You can request sample position to be fixed or non-fixed for textures (in my experience it does nothing on current implementations, and you always get fixed locations), on renderbuffers locations are always fixed.

05-24-2011, 03:26 PM
Thank you kyle_. You are right. You need to bind the fbo before making the query :).