Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Picking



On Wed, 25 Dec 2002, Brian Greenstone wrote:

> GL_SELECT does not return the actual z coordinate of the pick - it only
> returns the min/max zbuffer z-coordinate of the polygon in question.
> Therefore, unProjecting the screen pick coordinate will only put me in the
> ballpark since I do not know the legit z value.
>
> I suppose I could just average the z values I get from GL_SELECT and then
> just unproject that. That'll at least get me coordinates that are close as
> long as the polygons are small.

Even if the picking-by-selection method is falling out of favor, I thought
I should note for posterity that using the *average* Z values may not be a
good idea, if the objects generating hits in your scene are not convex. A
single hit can be generated by two wildly distant polygons, causing the
average Z value to be meaningless. Nowadays I use the minimum Z value.

Anyone interested in sample code might consult the SMKTester class in my
SMea Kit (link below, then "Software", etc.). This version is a little
outdated - in particular, it might still use the average Z value. In any
event it answers the original poster's question of how to extract
information from the hit record. It also handles collision testing (which
is similar) and comes with a detailed user manual.

Joshua Davis email@hidden http://www.math.wisc.edu/~jdavis/
_______________________________________________
mac-opengl mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/mac-opengl
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Picking (From: Brian Greenstone <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.