Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: GL_SAMPLE_POSITION return null values

  1. #1
    Junior Member Newbie
    Join Date
    May 2011
    Location
    Italy
    Posts
    22

    GL_SAMPLE_POSITION return null values

    Hi,

    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 ) );

    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, id);
    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] );
    }
    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);

  2. #2
    Junior Member Newbie
    Join Date
    May 2011
    Location
    Italy
    Posts
    22

    Re: GL_SAMPLE_POSITION return null values

    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 ?

  3. #3
    Member Regular Contributor
    Join Date
    Apr 2009
    Posts
    268

    Re: GL_SAMPLE_POSITION return null values

    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.

  4. #4
    Junior Member Newbie
    Join Date
    May 2011
    Location
    Italy
    Posts
    22

    Re: GL_SAMPLE_POSITION return null values

    Thank you kyle_. You are right. You need to bind the fbo before making the query .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •