depth values in picking
Posted by Mathieu Blossier on
URL: https://forum.jogamp.org/depth-values-in-picking-tp4030347.html
Hi,
I don't understand how values are set for depth in picking mode.
I use
(float) (selectBuffer.get(ptr)& 0xffffffffL) / 0x7fffffff;
and get a float between 0 and 2.
Objects on the near plane gets z = 0, and objects on the far plane gets z = 2, which I assume is correct. But for an object in the middle between near and far planes, I don't get z = 1, unless I use an orthographic projection.
I can't find the explanation for this in openGL documentation, so any help is welcomed :)
Thanks,
Mathieu