PDA

View Full Version : Fast selection



Mohamed Hassan
10-29-2003, 07:25 AM
Hello,
I need to get the top most objects without
filtering the zDepth of the selected objects. Can any one suggest a procedure.
I'll be very thanking.
'------------------------------
I posted the topic Selection over a polygonal region. I didn't get any help. Is it impossible or out of the popular interest?

Cyranose
10-29-2003, 11:24 AM
Originally posted by Mohamed Hassan:
Hello,
I need to get the top most objects without
filtering the zDepth of the selected objects. Can any one suggest a procedure.
I'll be very thanking.
'

I didn't read your other thread. The simplest answer is to use GL's built in picking and name stack, which has decent performance for occasional picking.

If you do raycasting yourself, you will have to sort the "hits," but that's not bad at all. I'm not sure why you would be averse to that.

The one alternative I can offer is to use the z-buffer to do your sorting. In that case, you'd render the potential hits (or the whole scene, if you're lazy) using a unique color per object or triangle. Doing a glReadPixels on a 1x1 square at the 2D pick-point is going to be pretty fast. One trick here is to pick the unique colors based on an object pointer, such that when you read the picked pixel back, you can get the desired pointer back without a table lookup.

Avi

Mohamed Hassan
10-29-2003, 12:14 PM
Thank you Cyranose,
I didn't try your procedure yet but I think that it will be more faster and appropriate for my case. I think also that the suggested procedure needs to disable lighting, antialiasing, dithering to keep the color from changing. Is there other comments for make this technique run correctly? Thank you again.

M.Hsn

Cyranose
10-29-2003, 12:55 PM
Originally posted by Mohamed Hassan:
Thank you Cyranose,
I didn't try your procedure yet but I think that it will be more faster and appropriate for my case. I think also that the suggested procedure needs to disable lighting, antialiasing, dithering to keep the color from changing. Is there other comments for make this technique run correctly? Thank you again.

M.Hsn

Yes. Thanks for noting that. For the color-tag rendering, you need to disable anything that causes color blending, including antialiasing (multisampling, blending, etc..), lighting, texturing, and alpha blending. Omit transparent objects if you don't want to pick them, but draw them opaque otherwise. Also, check your color depth. A pointer might be 32 bits, but you may only get 24 bits of color. Definitely no dithering. http://www.opengl.org/discussion_boards/ubb/smile.gif

Avi


[This message has been edited by Cyranose (edited 10-29-2003).]