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 Tuesday, December 24, 2002, at 04:52 PM, Brian Greenstone wrote:

Does anyone have any idea how to extract useful information about of an
OpenGL picking call? It seems that the data returned while in GL_SELECT
mode is only very rudimentary. It returns in the Pick Buffer only the
min/max z coords of the polygon that was picked and the user ID value.

Yeah. Good for drag-selection. Not-so-great for picking.

Is there any way to get accurate pick information such as the *real* z
coordinate of the pick, or the world x,y,z coordinates of the pick?

About all you can do is project back into world space via gluUnProject.

How about the UV value at the pick point?

There's only two ways to do this AFAIK... (1) solve for the uv coords yourself from the xyz position given your own knowledge of the geometry, or (2) do a second render pass of the selected object in which you render a 2d texture that encodes u/v, and use glReadPixels at the pick point to get the value out.

If you're going to do (2), you may find that there's not much point in bothering with GL_SELECT at all. I only use it for drag-selection. I use just a multi-pass render/glReadPixels for mouse-click picking. That'll give you an accurate depth value as well, in just one pass. The second pass is optional for getting out uv.

If code would help, let me know and I'll dig this up.
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: 
 >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.