   GLES2.0 Depth Test problem
  I am learning about GLES2.0.I cannot get the depth test work. In gl2.h depth functions are defined. But they seems have no effect in my android 2.1 program. The program just draw everything between -1 to 1 in z axis without any depth testing. Any idea why this happens?My init function:   glDepthMask(true);glDepthRangef (0.0f, 1.0f);glClearDepthf( 0.0f );glEnable(GL_DEPTH_TEST);glDepthFunc(GL_LESS);checkGlError("set enable depth");My render function:   glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);glEnable(GL_DEPTH_TEST);   glActiveTexture ( GL_TEXTURE0 );glBindTexture ( GL_TEXTURE_2D, texture[0] );glUniformMatrix4fv(gModelMatrixLoc,1,0,ModelMatrix);glDrawElements(GL_TRIANGLES,indicesSize,GL_UNSIGNED_SHORT,indices);My shaders: Vertices shader   "attribute vec4 vPosition;\n""attribute vec2 inputTexCoord;\n""uniform highp mat4 u_matViewProjection;\n""varying vec2 TextureCoordinates;\n"    "void main(void) {\n""  TextureCoordinates=inputTexCoord;\n""  vec4 OrthgonalProjection=u_matViewProjection * vPosition;\n"    "  gl_Position = OrthgonalProjection;\n"    "}\n"; Fragment shader:   "precision mediump float;   \n""uniform sampler2D tex1;\n""varying vec2 TextureCoordinates;\n"    "void main() {\n""  gl_FragColor = texture2D(tex1,TextureCoordinates);\n"    "}\n"; 
  First, you should change clean depth to 1.0 not 0.0!Values are aways clamped to the range [0,1]. 0 means "on the front clipping plane". There cannot be objects closer to you than those with depth 0.Second, move glEnable(GL_DEPTH_TEST); to "your init function".   ;Quote:Original post by Aks9First, you should change clean depth to 1.0 not 0.0!Values are aways clamped to the range [0,1]. 0 means "on the front clipping plane". There cannot be objects closer to you than those with depth 0.Second, move glEnable(GL_DEPTH_TEST); to "your init function".Thank you for your reply.first, I do have a glEnable(depth_test) in the init function.second, I tried about depth clear value 0.0f. There is no effect still.If it is the problem from clear depth value. Nothing should be draw to the screen. But What i got is that  all triangles are drawn in the presenting order no matter what the depth value or the clear value.;  Problem solved!I forget to change the value in the EGL configration.The depth should use a 24bit variable. the initial value for it is 0. So there was no depth buffer.Now it runs great.   