[OpenGL ES] Depth Test Enabled Without Depth Buffer

Forums Programming cocos2d support (graphics engine) [OpenGL ES] Depth Test Enabled Without Depth Buffer

This topic contains 4 replies, has 4 voices, and was last updated by  CJ 2 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
Author Posts
Author Posts
December 22, 2011 at 11:40 am #237924


This is a high severity message I get when running OpenGL ES Analyzer on a cocos 2.0 project with default settings (3d projection, depth test enabled). Details on the log:


Depth Test Enabled Without Depth Buffer


Depth testing enabled without an attached depth buffer


OpenGL ES Analyzer detected rendering with GL_DEPTH_TEST enabled into a framebuffer without an attached depth buffer. To get useful results from depth testing, attach a depth buffer to your FBO.

Responsible Command:

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)

What does it mean exactly? Can it affect performance? Thanks


If setting depthFormat:GL_DEPTH_COMPONENT16_OES instead of depthFormat:0 in AppDelegate removes that message from the analyzer, since it successfully creates the depth buffer.

Not sure though why is that set to 0 if depth test is enabled? Probably just a template error..?

December 22, 2011 at 12:37 pm #360010


Use it with 0 if you don’t want a depth buffer.

If you use a depth buffer of 16 or 24bits, cocos2d will perform a bit slower.

As far as I know, there is no performance penalty on enabling the depth buffer, but setting a 0-bit depth buffer.

December 22, 2011 at 12:40 pm #360011


Thanks @riq – as always a very quick answer :)

But just to clear that message from the opengl es analyzer, probably setting [director setDepthTest:NO] would be better if you don’t need it ?!

EDIT: thanks @araker – yeah :)

December 22, 2011 at 12:43 pm #360012


It’s safe indeed to turn off the depth test if you don’t have a depth buffer.

[[CCDirector sharedDirector] setDepthTest:NO];

That’s something that needs to change in the code as well. Turn the depth test on only if the EAGLView is initialized with a depth buffer. Not that the current situation will affect performance, the depth test can’t do a thing without a depth buffer.

I would only turn on the depth buffer if you need 3D effects. Otherwise it’s a waste of memory.

–edit, I see you already figured it out–

December 22, 2011 at 7:38 pm #360013


It’s probably not a performance issue but one of correctness. This should be filed as a bug to correct the behavior when there is no depth buffer the depth testing should be disabled.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.