I want to render to a colour texture also populating the depth buffer. I then want to render something else to another texture but depth test against the depth buffer from the first render.
I'm not interested in writing out packed depth values to a colour texture, i want to keep the existing populated depth buffer from the first render. All in OpenGL ES 2.0 via LibGDX
So i have an FBO with a depth buffer.
- I set the single allowed COLOR_ATTACHMENT0 to texA
- glCheckFramebufferStatus returns complete
- Render with depth testing (This produces the values i expect)
- Change the COLOR_ATTACHMENT0 of the FBO to texB
- glCheckFramebufferStatus returns complete
- Render with depth testing (this behaves as if the depth from step 3 does not exist)
I suppose my query is really does changing a COLOR_ATTACHMENT clear the depth buffers? If not i must have a different issue somewhere in my code :(
glClear()
call that includesGL_DEPTH_BUFFER_BIT
. – Reto Koradi