• Advertisement
Sign in to follow this  

Writing to the depth texture in a FBO

This topic is 1836 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi.

 

I have an FBO with several normal textures and one depth texture. I want to copy one of the normal textures to the depth texture. I've tried this by attempting to draw a full screen quad directly to the depth texture but it seems I cant use the depth texture as a render target.

 

How should I do this?

 

Thanks in Advance!

Share this post


Link to post
Share on other sites
Advertisement

Could use some more info on what youre trying to do, why cant you use the depth texture as a render target? are you getting errors? or is it just not rendering anything?

Share this post


Link to post
Share on other sites

Edit : My answer wouldn't give you what your after wacko.png . The post below is right :)  

Edited by Nyssa

Share this post


Link to post
Share on other sites

You can use gl_FragDepth to write out your own depth-values instead of using the ones generated by the rasterizer.

 

n.b. this generally disables Hi-Z optimizations for that depth-buffer until the next clear, as the Hi-Z buffers are generally populated by the rasterizer (which is incorrect in the case where you've replaced it's depth values).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement