Using FBO, you can display the results without displaying the results. If you are in ES 2.0, your fragment shader can access the current fragment depth (in window coordinates) as part of gl_FragCoord, so you can write this to the color buffer, use glReadPixels to return the result and continue. Alternatively, you can load the world space z as changing and write it from your fragment shader, if that is easier.
, , gl_FragCoord.z, , .
gl_FragColor = vec4(vec3(gl_FragCoord.z), 1.0);
, . , 0.0 ( unclipped ) 1.0 ( unclipped ). , , , .