PDA

View Full Version : How to select objects in 3D?



jojo555
04-22-2004, 05:11 AM
Hi.
I was quiet enthusiastically reading the chapter of redbook on selection, hoping to find a solution to my object picking problem for my project. To my disappointment, it didn't give a method to distinguish between objects at different depths, but which lie at the same cursor position. So once again, seeking the help of real opengl people over here. I simply want to select that object which lies at the frontmost. I have enabled depth buffering.

Thanks.

brcain
04-22-2004, 05:46 AM
Look at the pickdepth.c example in the RedBook? Try running it and notice how the closer square (name 1) has the lower depth value (0.333333). The lower the depth ... the closer it is.

jojo555
04-22-2004, 07:06 AM
OOps! I think i was in a hurry to read the chapter!
Thanks.