Hi, I followed a lot of tutorials about picking and I decided to use the Selection Buffer.
Now, the code that I wrote works as attended but I am in trouble to discover “the nearest object”.
In fact, I wrote in my code(as I successfully learned at http://pyopengl.sourceforge.net/documentation/opengl_diffs.html) :
hits = glRenderMode(GL_RENDER)
for record in hits:
min_depth, max_depth, names = record
and I tried to obtain the lower value of “min_depth“ (= “the nearest object”) but the result is no correct: the reason is that all my returned values of min_depth are identical.
Probably it is perhaps caused by a truncated internal representation – I am not sure, I am a novice in python too -, or by a bad pyopengl configuration.
For example, at page http://www.dei.isep.ipp.pt/~matos/cg/docs/manual/gluPerspective.3G.html I read:
bits of depth buffer precision are lost. Because r approaches infinity as zNear approaches 0, zNear must never be set to
and I used “gluPerspective(45,
1.0*width/height, 0.05, 100.0)” with the value “
Can you suggest me the correct way to calculate the lower value of “min_depth“? Or can you suggest me a alternative method to simulate a pick? I’d like to avoid color based method.
Thank you for your help.