0

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.

  1. I set the DEPTH Writing On.
  2. I disable the Color Writing (glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);)
  3. I set the DEPTH function to GL_LESS
  4. I choose the simpler Vertex Shader and a void fragment shader (void main(void) {}).
  5. I draw my scene
  6. I set DEPTH writing off
  7. I enable the Color Writing again
  8. 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.

Community
  • 1
  • 1
diego.martinez
  • 1,051
  • 2
  • 11
  • 25
  • 1
    Yes weird flickering is expected with your approach also called "Z-Fighting". `glDepthFunc( GL_LEQUAL)` for the second pass may makes it a bit better. – dari Sep 21 '15 at 13:11
  • no, the flickering contains no drawn primitives, is no Zfighting. All screen is backcolor clear. Is like the ClearColor changes from my Red to black at full speed. – diego.martinez Sep 21 '15 at 13:42

0 Answers0