Reference: Https://www.opengl.org/discussion_boards/showthread.php/172736-OpenGL-ES-Depth-Buffer-Problem
Environment: Eclipse,ndkr8,opengl es2.0,android
The recent development of Android OpenGL es2.0 using Eclipse and NDK has found that the object being drawn is not related to depth, but to the order in which it was drawn. Think about it, it should be that the depth test is not turned on, glenable (gl_depth_test) is turned on, but the depth test is not working. Online, because the window created by Eclipse did not open the depth test.
Seteglconfigchooser (translucent? New Configchooser (8, 8, 8, 8, Depth, stencil): new Configchooser (5, 6, 5, 0, Depth, stencil)),//depth and setencil need to be set to 1
After setting, the order of the objects drawn is really related to the depth.
Summarize the open depth test:
(1) The window to be drawn first is set to support depth testing
(2) in OpenGL es2.0 code, you have to open the depth test (glenable (gl_depth_test))
Android +ndk+eclipse+opengl ES2.0 Open Depth test