GlDepthMask (GL_FALSE) removes the frame buffer on some GPUs

I sometimes disable writing depth buffers through glDepthMask(GL_FALSE) during frame rendering. This works fine on some GPUs (e.g. Motorola Droid PowerVR), but, for example, on HTC EVO with Adreno GPU, I get a full frame buffer, which is full garbage (I see traces of meshes that I represented somewhere but the whole screen is mostly broken).

If I make glDepthMask be true all the time, everything works fine.

I need glDepthMask to disconnect during the alpha rendering part. What can cause the framebuffer to be destroyed, causing a write-off of depth?

+6
android opengl-es depth-buffer
source share
3 answers

The problem was that glDepthMask must be true when calling glClearDepth . This, apparently, applies only to Adreno GPUs, not PowerVR GPUs.

+6
source share

Not sure if this will help, but it seems to me that you still need to clear the depth buffer - especially before disabling glDepthMask. I believe that glDepthMask allows you to enable / disable records, not depth tests. Perhaps the GL implementation still checks the old depth buffer information from the previous rendering session and thus only draws part of the screen. Then it looks broken. Some implementations can clear the depth buffer, others not? Feel neglected if this sentence does not fully match the meaning.

In any case, I hope this helps in a small way.

+1
source share

iPhone4 / iOS Simulator. If I did not set glDepthMask to true before glClear, I get my rendering. I spent two days with this problem, dropping framebuffers to disk, examining the trace of the entire frame, entering the code ... It was the only thing that worked.

NEVERMIND. I'm dumb. I ran glClear (COLOR | DEPTH) with a depth mask = false, so the depth buffer was not cleared at all. My first answer was triggered by a whole day of debugging: /

0
source share

All Articles