I have been checking the SO for this question, and even I found a similar question (OpenGL ES 2.x: any way to reuse depth buffer for off-screen and on-screen rendering?) saying it can't be done, I found it differs from my intention.
My intention is to relieve the shader fragment opperations by using the depth buffer to discard occluded-gonnabes.
- I set the DEPTH Writing On.
- I disable the Color Writing (glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);)
- I set the DEPTH function to GL_LESS
- I choose the simpler Vertex Shader and a void fragment shader (void main(void) {}).
- I draw my scene
- I set DEPTH writing off
- I enable the Color Writing again
- I draw each object again with his own shaders this time
But this does not work (I use OpenGL ES 2.0). If I disable Color Writing in first pass, I get no image (and some weird flickering), if I skip pass 2 and 7, i get no fps rate change.
Why? Is there something wrong in my logic? I dont mess with the FBOs, I just call the drawing of VBOs 2 times.