Login  Register

Why is the z value read from glReadPixels always 1.0?

Posted by Irene Tang on Mar 01, 2016; 7:31am
URL: https://forum.jogamp.org/Why-is-the-z-value-read-from-glReadPixels-always-1-0-tp4036395.html

Hi, I want to transform screen coordinates to word coordinates?
I used gl2.glReadPixels(e.x, viewportMatrix[3] - e.y, 1, 1, GL2.GL_DEPTH_COMPONENT, GL2.GL_FLOAT, FloatBuffer.wrap(winZ)) to get depth value of (x,y) in screen coordinates. But no matter how to change (x,y), the value of winZ is always 1.0. How can i get the actual depth value?