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…

  
-----------------------------
|              |            |
|              |            |
|    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

Have you set the texture environment ?

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).

^ 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.