Writing to the depth texture in a FBO

Started by
3 comments, last by Wilhelm van Huyssteen 11 years, 3 months ago

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!

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?

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

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).

Thanks for the reply thats what I needed.

This topic is closed to new replies.

Advertisement