Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Multiple Render Targets with FBO?

  1. #1
    Intern Contributor
    Join Date
    Feb 2006
    Posts
    62

    Multiple Render Targets with FBO?

    I am trying to use a FBO to render a scene to a depth texture and a color texture. Then I want to be able to display each of the textures on a quad. Basically what I do is something like this:

    Loop {
    Render To FBO
    Bind Depth Texture
    Display Quad Textured with Depth Texture
    Bind Color Texture
    Display Quad Textured with Color Texture
    }

    What I want to end up with would be a rectangle with one halfe textured with the depth texture and the other have texture with the color texture, like this....

    Code :
    -----------------------------
    |              |            |
    |              |            |
    |    Depth     |    Color   |
    |   Texture    |   Texture  |
    |              |            |
    |              |            |
    |              |            |
    -----------------------------
    The depth part works fine... but the color texture doesn't.... Before I post any code or get too involved in this, my first question would be:


    Can I create a FBO and attach both a depth and color texture, then render the scene to the bound FBO and expect both textures to be rendered to?



    Ed

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,749

    Re: Multiple Render Targets with FBO?

    Have you set the texture environment ?

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    587

    Re: Multiple Render Targets with FBO?

    You can do it according to the spec. I need depth and stencil as well as colour and it works for me (but I'm using EXT_packed_depth_stencil and renderbuffers, not textures). I've got some code that'll hopefully work in the future that (after attaching a colour component) loops through depth attachments and tries stencil attachments. It shows complete FBOs for (all) the depth attachments alone, but incomplete when I try to attach any stencil component to it. So I'm guessing you can do colour and depth since I'm getting complete FBOs with those attachments on my work machine (FX5200).

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    587

    Re: Multiple Render Targets with FBO?

    ^ I lied. Like zed said in the other current FBO thread, depth attachment doesn't work for 16-bit depth components - only 32- or 24-bit on my FX5200.

Posting Permissions

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