Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Texture multi sampling in OpenGL 3.3

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Intern Contributor
    Join Date
    Mar 2011

    Texture multi sampling in OpenGL 3.3

    Hi all. I am really going mad about this issue.I want to implement MSAA .I have read OpenGL super bible and some other articles where there are some examples.What I understood from most of that data was that I need to
    set up another FBO ,render samples to texture ,then feed it into the default FBO ? I don't get it .Can't I do MSAA in the default FBO ? In Super Bible the example is very problematic as it is used to present post processing effects so it can't be understood from it if it can be done with the default frame buffer .Anyways I am trying to do this this way (using LQJGL API) :

    texture setup :
    Code :
       _textureID = glGenTextures();
            glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _textureID);
            glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 8, GL_RGB32F, _textureW, _textureH, false);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
            glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, _textureID, 0);

    Then in the render loop I do this:
    Code :
            glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _textureID);

    Now inside fragment shader I ,for now removed the sampling part and currently trying just to get the texture displayed on the plane because now it is black.So I just left this part:

    Fragment :
    Code :
    #version 330 
    in vec2 uvsOut;
    uniform sampler2DMS origImage;
    uniform samplerBuffer sampleWeightSampler; 
    uniform int sampleCount;
    uniform int useWeightedResolve; 
    out vec4 outputColor;
    void main(void) 
       vec3 a5 =texelFetch(origImage, ivec2(uvsOut.xy),8).rgb;
      //  outputColor = texelFetch(origImage, ivec2(uvsOut));

    So ,the result I am getting so far is a black color. Anyone can help with this ?

  2. #2
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Watford, UK
    texelFetch(origImage, ivec2(uvsOut.xy),8)

    replace 8 with 0.

Tags for this Thread

Posting Permissions

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