PDA

View Full Version : picking problem



dmsy
04-04-2000, 05:57 PM
The red book didnt mention much about picking when an 2 objects are on top of the other one (z axis). How do I achieve picking the highest (closest to me) object?

ben
04-05-2000, 08:51 AM
If you're using the GL selection mode, the hit records include min and max z values for each hit. You can use these to determine the closest to the camera.

dmsy
04-05-2000, 09:30 AM
If I use assign names to each object and each object overlap each other on the z axis, will the buffer have information on all the names of the object so I can deside on which object to pick, OR does it only give me the number of hits and max/min z values?

ben
04-05-2000, 03:15 PM
The gl selection mode is a "shoot-through" selection. Therefore, everything that intersects the picking region will register a hit.

One thing to remember is that each hit record will have as part of it the contents of the name stack at the time of the hit. One way to simplify the hit record is to ensure that you only push one name onto the name stack and use glLoadName for subsequent names. This will simplify the hit record processing (however, this may not be acceptable for every application).

Hopefully this helps.