PDA

View Full Version : accessing framebuffer when using fbo and render to texture



alkiem
10-22-2005, 05:16 PM
Hi,
my question is quite simple, is it possible to read in a shader the texture which is bound to the current fbo? In fact since it is not possible to access framebuffer in fragment shaders, i doubt it is possible, but could anyone confirm it, please?

For those interested, i'm trying to implement double depth pass shadow map using fbo and depth_stencil_ext: first I draw back faces with stencil keeping trace of which pixel are rendered in depth map, then I draw front faces only where the stencil have been modified. And i need to average the depth map after first pass with depth of fragments from second pass. But texture fetch to read the depth map doesn't seem to work so I guess it is not allowed.

Thanks in advance.

valiant
10-22-2005, 05:42 PM
hi, i'm new to this and read just recently about framebuffer objects.
it seems you can't read from the texture and write to the buffer at the same time. you've got to switch between binding it as fb and as texture.
some examples:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=013087;p=2
but i guess this you already knew and you're just wondering if you could still do it somehow through shaders.

alkiem
10-23-2005, 04:18 AM
Thanks for the reply. I think that what i need would be multiple render depth target, if i was able some how to render the first pass both in the depth texture bound to the fbo and in another target/depthtexture, that would be perfect. Any hope that this feature could be added in a near future?

[Edit]
May be i could do such thing with writing depth in a color attachment, but then i'll lose the double speed depth write improvement on new hardware.
Sorry, my problem sounds more of opengl advanced coding than glsl :S.