PDA

View Full Version : Using main depth buffer



BigHands
08-26-2008, 05:39 AM
I'm porting some code from Direct3D to OpenGL and I'm a bit lost on how to approach the following:

- Render objects to main depth and color buffers (window system provided)
- Create a new render target (application created)
- Turn off depth writes
- Write new geometry to new render target using main depth buffer for depth tests

I was looking into FBOs, but it seems like this is just not possible with them. Any suggestions? Which extensions should I be looking at?

babis
08-26-2008, 08:43 AM
- Render objects to main depth and color buffers (window system provided)
- Copy depth values from main framebuffer to a depth texture
- Create a new render target & attach it to fbo
- Attach depth texture to fbo
- Turn off depth writes
- Render new geometry

.. that should do the job, though there might be a faster way I didn't think.