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 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Framebufferobject, DepthTest and Floating Point

  1. #1
    Intern Newbie
    Join Date
    May 2005
    Location
    Austria
    Posts
    49

    Framebufferobject, DepthTest and Floating Point

    Hi, I checked the combination of FBO and Floatingpoint Textures. Everything works fine. But when I enable depth testing, nothing works. I can get around this problem by setting glDrawBuffer to GL_NONE, but is there no way to use both at the same time?
    Thanks,
    Benjamin

  2. #2
    Intern Newbie
    Join Date
    May 2005
    Location
    Austria
    Posts
    49

    Re: Framebufferobject, DepthTest and Floating Point

    The thing I forgot the mention: I have a renderbuffer as depth buffer, color buffer has got a texture, with the internal format GL_RGB (or similar) the combination (FBO+DepthTest) works fine and very well. But when I change the internal format of the texture to GL_RGB16F_ARB it doesn't work anymore.
    In both cases, I write frag and depth values with a fragment shader.

  3. #3
    Junior Member Regular Contributor Zulfiqar Malik's Avatar
    Join Date
    Jun 2004
    Location
    London, UK
    Posts
    248

    Re: Framebufferobject, DepthTest and Floating Point

    Are you checking whether the texture and render buffer is being attached properly without any errors? What hardware are you using? I worked with FBO's on NV3x sometime back, and they had some bad problems with render buffers. So i had to revert back to using depth texture. You can try that too. Just use a depth texture instead of a depth render buffer as the depth attachment. I doubt that there will be any performance difference between using render buffers or regular textures, but can't say for certain.
    Zulfiqar Inayat Malik.
    Senior Developer, The Foundry.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    134

    Re: Framebufferobject, DepthTest and Floating Point

    What hardware/driver are you using?

  5. #5
    Intern Newbie
    Join Date
    May 2005
    Location
    Austria
    Posts
    49

    Re: Framebufferobject, DepthTest and Floating Point

    1. I check the framebuffer object after attachment of the renderbuffer and the depth buffer. Everything seems ok. The init:

    Code :
    const float bcolor[4] = {0,0,0,0};
     
    	// create renderbuffer and framebuffer
    	glGenFramebuffersEXT( 1, &fb );
     
    	// texture
    	glGenTextures( 1, &tex );
    	glBindTexture( GL_TEXTURE_2D, tex );
    	glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB16F_ARB, 512, 512, 0, GL_RGB, GL_FLOAT, 0 ); 
    	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
    	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
    	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
        glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, bcolor);
     
    	// render buffer
    	glGenRenderbuffersEXT( 1, &depth_rb );
    	glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, depth_rb );
    	glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, width, height );
    the bind:
    Code :
    	glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fb );
    	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex, 0);
    	glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_rb );
    2. My card is an ATI 9600. I am using drivers from last friday, 9th, GL_VERSION = 2.0.5523

    As I told you in my first postings, everything works fine, if I
    a. turn off depth testing
    b. or use fixed point format as internal format for the texture. But I need the combination of both.

  6. #6
    Intern Newbie
    Join Date
    May 2005
    Location
    Austria
    Posts
    49

    Re: Framebufferobject, DepthTest and Floating Point

    Addon: I also tried with depth texture. Same problems like before

  7. #7
    Intern Contributor
    Join Date
    Oct 2005
    Posts
    51

    Re: Framebufferobject, DepthTest and Floating Point

    Verify the width and height values in glRenderbufferStorageEXT. Your code is working at 9600, ATI 5.10

  8. #8
    Intern Newbie
    Join Date
    May 2005
    Location
    Austria
    Posts
    49

    Re: Framebufferobject, DepthTest and Floating Point

    I checked it. Same problem persits with both set to 512x512 and other power of two sizes.

    @Racoon:
    Does it also work, when you try the following:

    BIND BUFFER
    ENABLE DEPTH TEST
    RENDER
    DISABLE DEPTH TEST
    UNBIND BUFFER

    Because without depth testing enabled it works on my card too. But not when I enable depth testing. I also checked this combination on a nvidia. So the questions comes to my mind, if FBO+DepthTesting+Floating Point Textures are not allowed? But there is nothing about that in the spec.

  9. #9
    Intern Contributor
    Join Date
    Oct 2005
    Posts
    51

    Re: Framebufferobject, DepthTest and Floating Point

    Anyway it is working.

    But is unexpected color behavior. So, render code:
    Code :
    glColor (1, 1, 0);
    DrawPrimitive ();
    glColor (1, 0, 0);
    DrawPrimitive ();
    Both primitives is red in contrast to in framebuffer 0 output -- first - yellow, second - red.

  10. #10
    Intern Newbie
    Join Date
    May 2005
    Location
    Austria
    Posts
    49

    Re: Framebufferobject, DepthTest and Floating Point

    I am afraid I cannot really follow you. I write the frambuffer and the depth buffer's values with shaders. (gl_FragColor and gl_FragDepth). I have no such abnormal color behaviour. Can you please exactify your assumption?

Posting Permissions

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