|
|
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.
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?
CD
|
|
0
|
|
|
|
Reply
|
spamtrap8 (4)
|
5/1/2006 4:14:33 PM |
|
yes, this is possible. usually you would create a fbo with two
attachments (the depth and color attachment).
when you render to the fbo both buffers should be filled.
you should also check if the textures for the depth and color buffer are
unbound when you render to the fbo. concluding from your listing below
it seems to me that the color texture would still be active.
cheers,
david
CelticDaddio schrieb:
> 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.
>
> 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?
>
>
> CD
>
|
|
0
|
|
|
|
Reply
|
David
|
5/2/2006 7:55:57 AM
|
|
So... if, after I create the texture for the color attachment, if this
texture is still bound when I render to the FBO, I will not see the
results in the color texture?
CD
|
|
0
|
|
|
|
Reply
|
CelticDaddio
|
5/3/2006 2:14:08 PM
|
|
Hi,
> So... if, after I create the texture for the color attachment, if this
> texture is still bound when I render to the FBO, I will not see the
> results in the color texture?
The answer to that question is: it depends. It also doesn't matter.
If you post the relevant snippets of code you're using for setting up
the FBO and rendering to it, then I should be able to tell you what's
going wrong.
All the best,
Nicholas
http://www.netsoc.tcd.ie/~nash
|
|
0
|
|
|
|
Reply
|
Nicholas
|
5/3/2006 8:20:20 PM
|
|
|
3 Replies
333 Views
(page loaded in 0.251 seconds)
|
|
|
|
|
|
|
|
|