Advertisement

picking in 3D

Started by August 06, 2002 08:40 PM
2 comments, last by kish 22 years, 6 months ago
Hi, this is a simple question about how to pick object in 3D. I'm using glRenderMode(GL_SELECT) for picking, and after going back to GL_RENDER mode I get the hits record. In 3D I get more than one hit and I get the GLuint z1,z2 values for each hit. I think that according to the Red-Book I supposed to do: minimum depth=(float) z1/0x7fffffff; maximum depth=(float) z2/0x7fffffff; (why to use 0x7fffffff ? the red-book doesn't say) anyway, what is the meaning of the max/min depth values ? [edited by - kish on August 6, 2002 9:42:55 PM]

I tried to implement the Red-book''s code.
When I pick an object, I get the name of the object which is correct, and the names of other objects that are behind the object that I picked.
the depth values that I get are always between 1-2 and always positive, I don''t know what these number mean, these are not Z coordinates. so what are these numbers ?

If you can explain these, I would appreciate it very much
Advertisement
0x7fffffff = 30% alphablending, if you got that turned on.

.lick
A good way to pick in 3D is to use the basic 2D picking code, and then just sort the resulted objects by their Z-index. A good way to store them is in a linked list (just search for linked list in some search engine. Anything you find should be good). Then, you just select the closest object. If you want some more help with linked lists, e-mail me at CharlieMC86@hotmail.com

This topic is closed to new replies.

Advertisement