Archived

This topic is now archived and is closed to further replies.

Syrillix

Drag selecting??

Recommended Posts

Syrillix    122
well as the subject implies im trying to figure out how to drag selecting in 3d. my first idea was to transform the position vectors of the visible set of objects into screen space and test if they lie in the box formed by the drag. my other idea is to create a "box" by calculating the ray from each point formed by the drag and extending the rays out to the zfar distance and test the positions against the box. anyone have any suggestions on this?

Share this post


Link to post
Share on other sites
kronq    122
If you''re using OpenGL you can use GL_SELECTION render mode to get a list of primitives inside the specified screen rectangle.
http://www.opengl.org/developers/faqs/technical/selection.htm

Another popular way that works in OpenGL or DX is to render the selected rectangle of your scene into a buffer, assigning each primitive a 32-bit identifier for its color and using flat shading. Then you can scan through the resulting buffer and pick out all the different id''s present.

Share this post


Link to post
Share on other sites