Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Corruption in Stencil textures with glTexImage2DMultisample

  1. #11
    Junior Member Regular Contributor
    Join Date
    Jun 2012
    Posts
    190
    I read some of the posts regarding depth_stencil textures and found that it is just same as depth textures without shadow mapping (normal sampler2D) and no need to add any special code regarding stencil test though i tried with that too. I am using AMD catalyst on windows, i guess it might be buggy.

  2. #12
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,101
    Here is my render buffer
    Code :
      glGenFramebuffers(1, &c_ID);
      glBindFramebuffer(GL_FRAMEBUFFER, c_ID);
     
      glGenTextures(1, &c_RenderTexture);
      glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, c_RenderTexture);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
      glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, c_Samples, GL_RGBA, c_Width, p_Height,GL_FALSE);
      glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, c_RenderTexture, 0);
     
      if (c_HasDepthBuffer)
      {
          glGenTextures(1, &c_RenderDepthTexture);
          glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, c_RenderDepthTexture);
          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
          glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
          glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
          glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, c_Samples, GL_DEPTH24_STENCIL8, c_Width, c_Height, GL_FALSE);                
          glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D_MULTISAMPLE, c_RenderDepthTexture, 0);
      }

    Hope that helps.

  3. #13
    Junior Member Regular Contributor
    Join Date
    Jun 2012
    Posts
    190
    Thanks all for your replies.
    I tried my code on other driver and it works perfectly fine. AMD really need to fix lot of issues.

    Just to confirm, i am getting same output for GL_DEPTH_STENCIL_ATTACHMENT and GL_DEPTH_ATTACHMENT i.e. same output for depth texture and depth-stencil textures, which is correct right?

  4. #14
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,101
    The depth values will be the same but they have different uses

    form the specs

    If the base internal format is DEPTH_STENCIL and format is not DEPTH_-
    STENCIL, then the values of the stencil index texture components are undefined.

Posting Permissions

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