PDA

View Full Version : Setting texture as depth



bobsyouruncle
01-14-2007, 08:45 AM
I have a deferred shading engine using FBOs that captures 3 "color" channels and a depth channel. Since the FBO rendering context claims the depth buffer rendered as its own, any rendering made post-deferred-shader cannot make use of the depth values (i.e. alpha geom, particles, FX, etc). Is there some way to replace the depth values in the default rendering context, from the texture captured by the FBO?

P.S. For the FBO, I have not actually allocated pixel data for any of my buffers, so I cannot use glDrawPixels.

Bob

PfhorSlayer
01-14-2007, 11:12 AM
I don't think you can replace the DEFAULT context's depth buffer with your own, but you can create an additional FBO and share the depth renderbuffer with it.

knackered
01-14-2007, 01:13 PM
disable colour writes and draw a quad using the depth texture with depth test disabled.....or am I missing something?

bobsyouruncle
01-14-2007, 02:38 PM
This will set the depth value of the texture to the depth buffer outside any FBO? I've never seen anything like this, is there an example that anybody knows of that demonstrates this?

Bob

Zengar
01-14-2007, 11:29 PM
http://opengl.org/registry/specs/EXT/framebuffer_blit.txt

This would be the simplest way, but only Nvidia has currently support for it.