Sampler2DMS and texelFetch()

Assuming I have a FBO correctly set up using glTexImage2DMultisample( target, 4, GL_RGBA8, width, height, GL_FALSE ); (ie the ARB_texture_multisample extension) and I have rendered an image into it and then set it up as a texture to be used in a GLSL program… then I have the following questions:

  1. I should define the texture in my program as “uniform sampler2DMS textureImage;” correct?

  2. I should use texelFetch() instead of texture2D() to do my lookup correct?

Assuming I am using texelFetch():

  1. The second parameter is an “integer texture coordinate P”… why an integer? Does this range from 0 to the texture width/height? Or does it range from 0 to (width/height * samples)? Is there a function that will convert a texture coordinate in the range of 0-1 to a value for this lookup?

  2. What is the third parameter? What do I set it too?

ARB_texture_multisample:
Syntax:

  gvec4 texelFetch(gsampler2DMS sampler, ivec2 P, int sample)
  gvec4 texelFetch(gsampler2DMSArray sampler, ivec3 P, int sample)

Description:

  Use integer texture coordinate <P> to lookup a single sample
  <sample> on the texture bound to <sampler> as described in section
  2.11.7.1 of the OpenGL specification "Multisample Texel Fetches".

2.11.7:
Texel Fetches
The OpenGL Shading Language texel fetch functions provide the ability to extract a single texel from a specified texture image. The integer coordinates passed to the texel fetch functions are used directly as the texel coordinates (i, j, k) into the texture image. This in turn means the texture image is point-sampled (no filtering is performed).

2.11.7.1:
Multisample Texel Fetches
Multisample buffers do not have mipmaps, and there is no level of detail parameter for multisample texel fetches. Instead, an integer parameter selects the sample number to be fetched from the buffer. The number identifying the sample is the same as the value used to query the sample location using GetMultisamplefv. Multisample textures support only NEAREST filtering.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.