title: In OpenGL ES 2.0 depth texture buffer is not working when using FBO with texture depth buffer
body: <p>Currently I'm working on a project for rendering applications to Framebuffer Object(FBO) first, and rendering back the applications by using the FBO color and depth texture attachments in OpenGL ES 2.0 .</p>
  
  <p>Now multiple applications are rendered well with color buffers. When I'm trying to use depth information from depth texture buffer, it seems not working. </p>
  
  <p>I tried to render depth texture by sampling it with texture coordinate, it is all white. People say the grayscale may differ quite slightly, namely even in the shadow part it's near to 1.0. So I modify my fragment shader to like following:</p>
  
  <pre><code>    vec4 depth;
      depth = texture2D(s_depth0, v_texCoord);
  
      if(depth.r == 1.0)
          gl_FragColor = vec4(1.0,0.0,0.0,1.0);
  </code></pre>
  
  <p>And without surprise, it's all red.</p>
  
  <p>The application code:</p>
  
  <pre><code>void Draw ( ESContext *esContext )
  {
  UserData *userData = esContext-&gt;userData;
  
  // Clear the color buffer
  glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  // Draw a triangle
  GLfloat vVertices[] = {  0.0f,  0.5f, 0.5f, 
                         -0.5f, -0.5f,-0.5f,
                          0.5f, -0.5f,-0.5f };
  
  // Set the viewport
  glViewport ( 0, 0, esContext-&gt;width, esContext-&gt;height );
  
  // Use the program object
  glUseProgram ( userData-&gt;programObject );
  
  // Load the vertex position
  glVertexAttribPointer ( 0, 3, GL_FLOAT, GL_FALSE, 0, vVertices );
  
  glEnableVertexAttribArray ( 0 );
  
  glDrawArrays ( GL_TRIANGLES, 0, 3 ); 
  
  eglSwapBuffers ( esContext-&gt;eglDisplay, esContext-&gt;eglSurface );
  }
  </code></pre>
  
  <p>So, what would be the problem, if color buffer works fine, while depth buffer doesn't work?</p>