View Full Version : picking problem
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?
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.
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?
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.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.