I'm wondering if it is possible to bind the default frame buffer's depth as a texture so that it can be sampled from in a fragment shader (during rendering passes which do not write to that depth buffer)? If so, some pointers would be appreciated.
Asked
Active
Viewed 355 times
1
-
Wouldn't it be easier to render to some other framebuffer and then use it's depth texture? – MarGenDo Jan 01 '17 at 00:30
-
I think it would be duplicated effort in this case though. Basically, in the first pass I want to render let's say a planet to the default frame buffer color attachment, using and writing to depth so it is rendered correctly. Then, I want to do some post processing on the default framebuffer, which does not require writing to depth but does require reading the depth... I could render the depth to a separate frame buffer, but it seems like duplicated effort, no? Unless there is some way to bind a custom depth attachment to the default frame buffer. I (maybe wrongly) assume that's not possible. – user8709 Jan 01 '17 at 00:46
-
1I think the easiest way to do this is to render the planet to a framebuffer and then use it's color and depth attachment for post-processing effects rendered on the default framebuffer. – MarGenDo Jan 01 '17 at 00:58
1 Answers
0
You cannot bind any of the native window surface attachments as textures; it's simply not possible in the API.

solidpixel
- 10,688
- 1
- 20
- 33