Re: wrong depth values when rendering in GL_SELECT mode

Posted by gouessej on
URL: https://forum.jogamp.org/wrong-depth-values-when-rendering-in-GL-SELECT-mode-tp4025804p4025810.html

misha wrote
I have seen the first example and mistake is not with pick processing or
signed nature of java ints. For some reason z coordinates returned to
select buffer are all the same. Thus I can not check what object is nearer.

Problem is reproducible on win xp 32 bit. I tried running this code on win
7 64 bit and there coordinates are correct, so I can properly sort objects.
I don't know where problem is: in jogl, in opengl drivers, etc. And I don't
know how further investigate this problem :(.

If anyone has any clue I would be very grateful!
You use some basic OpenGL methods in this example (not an high level helper class) and JOGL is mostly a straight Java binding for the OpenGL API. You say that your bug is only reproducible under Windows XP 32 bits, it is probably a driver bug. Try to update your driver but anyway, OpenGL picking should NOT be used anymore:
http://www.opengl.org/wiki/Common_Mistakes
A modern OpenGL program should not use the selection buffer or feedback mode. These are not 3D graphics rendering features yet they have been added to GL since version 1.0. Selection and feedback runs in software (CPU side). On some implementations, when used along with VBOs, it has been reported that performance is lousy.

A modern OpenGL program should do color picking (render each object with some unique color and glReadPixels to find out what object your mouse was on) or do the picking with some 3rd party mathematics library.
Color picking does not work on some machines simulating some colors of their palette, that's why the last option is the best.
Julien Gouesse | Personal blog | Website