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 Wednesday, December 25, 2002, at 01:20 PM, Timothy J. Wood wrote:

On Wednesday, December 25, 2002, at 12:41 PM, Brian Greenstone wrote:
That's exactly what I've spend all day doing. I just finished it 3 minutes
ago and it works perfectly now. It's too bad that OpenGL doesn't have this
built in for a few reasons tho:

It's been a while since I looked at picking, but I don't see why you couldn't work around the min/max depth value by doing a glReadPixels on the depth buffer for the single pixel under the cursor to get the 'exact' transformed depth value. If you pass this into gluUnproject along with the screen x/y you should get pretty good results.

Tim's right, that's the way to do it. I was trying to communicate that in my earlier email, but it may not have been clear.

You will still probably get more precise results by computing the final point via ray/triangle intersection tests yourself (since the depth buffer is typically 'only' 24 bits has non-linear precision :). Dunno how much the precision matters to you, though.

FWIW, it matters to me a lot, and it's been fine. After all, you only have so much x/y picking precision anyways.

If you're doing dragging, and you don't want the object to pop slightly forward or backward in z, you can use successive z values as a delta-z rather than using each as an absolute coordinate. I've found that has somewhat better stability.

Dan
_______________________________________________
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: "Timothy J. Wood" <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.