Getting a texture from a renderbuffer in OpenGL?
- by Rushyo
I've got a renderbuffer (DepthStencil) in an FBO and I need to get a texture from it. I can't have both a DepthComponent texture and a DepthStencil renderbuffer in the FBO, it seems, so I need some way to convert the renderbuffer to a DepthComponent texture after I'm done with it for use later down the pipeline.
I've tried plenty of techniques to grab the depth component from the renderbuffer for weeks but I always come out with junk. All I want at the end is the same texture I'd get from an FBO if I wasn't using a renderbuffer. Can anyone post some comprehensive instructions or code that covers this seemingly simple operation?
EDIT:
Linky to an extract version of the code
http://dl.dropbox.com/u/9279501/fbo.cs
Screeny of the Depth of Field effect + FBO - without depth(!)
http://i.stack.imgur.com/Hj9Oe.jpg
Screeny without Depth of Field effect + FBO - depth working fine
http://i.stack.imgur.com/boOm1.jpg