Why is the z value read from glReadPixels always 1.0?
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?
Re: Why is the z value read from glReadPixels always 1.0?
I don't understand what you said. I think the reason might be that nothing ever rendered in the clicking point, so the z-depth would be the default 1.0.