Sign in to follow this  
Achilleos

antialiased FBOs

Recommended Posts

Hi, me again. I want to encounter the aliasing effects of my rendering when using frame buffer objects. I found the extension GL_EXT_framebuffer_multisample which has been released on januar this year. The extensions offers multisample support for renderbuffers but not for textures as render targets. Nevertheless and cannot bring the extension to work for my depth buffer. glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) gives me a GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT and as a lack of the early state of the extension i almost found no information what possibly could be wrong. Here's my fbo setup.
if(GLEW_EXT_framebuffer_object)
  {
    // create frame buffer object
    glGenFramebuffersEXT(1, &fbo_id);
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo_id);

    // create render buffer for depth component
    glGenRenderbuffersEXT(1, &fbo_renderbuf);
    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fbo_renderbuf);
    if(fbo_antialiased)
    {
      int max_samples;
      glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_samples);
      glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT,
        min(max_samples, 4), GL_DEPTH_COMPONENT, fbo_width, fbo_height);
      HelperDrawings::glPrintText(WHITE, 5000, "Created multisample fbo with %i samples.", max_samples);
    }
    else
      glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, fbo_width, fbo_height);

    // create number of requested attachments
    for(unsigned int i = 0; i < fbo_num_of_attachments; i++)
    {
      // set up textures
      glGenTextures(1, &fbo_tex[i]);
	    glBindTexture(GL_TEXTURE_2D, fbo_tex[i]);
		  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8,  fbo_width, fbo_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
		  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
		  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // GL_LINEAR);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // GL_LINEAR_MIPMAP_LINEAR);
      glGenerateMipmapEXT(GL_TEXTURE_2D);

      // attach the textures
      glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i, GL_TEXTURE_2D, fbo_tex[i], 0);
    }

    // attach render buffer (for depth component)
	  glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, fbo_renderbuf);

Has someone worked with this extension before and has a hint for me? Greetings, Achilleos.

Share this post


Link to post
Share on other sites
afaik - there is no AA for depth buffers...

...what should be the meaning of interpolated depth values ???

cheers
- zimerman

Share this post


Link to post
Share on other sites
MSAA means that the color calculation is shared between all more then one fragment per pixel. FOr example 4x MSAA means that there are 4 of each Color and Z buffer, The only difference to SSAA is that the shader runs only one time.

It's not possible, to render direct to a texture, because many GPUs use their Ramdac to composite the 4 Buffers. You need the framebuffer blitt extension, to copy the rendered image to a texture.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this