Android + NDK + eclipse + opengl ES2.0 enable deep test, ndkes2.0
Reference: https://www.opengl.org/discussion_boards/showthread.php/172736-OpenGL-ES-Depth-Buffer-Problem
Environment: eclipse, ndkr8, opengl es2.0, android
Recently, I used eclipse and NDK for android opengl es2.0 development. I found that the display of the drawn object is not related to the depth, but is related to the order of the draw. After thinking about it, it should be that the deep test is not enabled, and the GL_DEPTH_TEST is enabled, but it still does not work. I checked it online because the deep test is not enabled in the window created by eclipse.
SetEGLConfigChooser (translucent? New ConfigChooser (8, 8, 8, 8, depth, stencer): new ConfigChooser (5, 6, 5, 0, depth, stencer )); // depth can be set to 16 or 8, representing the number of cache bits
After setting, the order of the drawn objects is related to the depth.
To sum up, enable the deep test:
(1) The Window used for drawing must be set to support deep testing.
(2) In opengl es2.0 code, you must enable the deep test (GL_DEPTH_TEST ))