Archived

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

Selecting an object

This topic is 5113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to select an object within my program using a mouse click. However when I click on the object, it does not get selected ... instead the entire screen flashes ... any ideas? Peace, Love and Rabid Chipmunks - B :-P

Share this post


Link to post
Share on other sites
ummm .... when I change glRenderMode(GL_RENDER); to glRenderMode(GL_SELECT); it causes the entire image to dissapear and stay gone.

is there any way that I could select an object either using a glutmouse function or something else rather than using a selection buffer?

[edited by - heathcliff17 on December 15, 2003 5:22:55 PM]

Share this post


Link to post
Share on other sites
You''ll get better framerate if you don''t use GL_SELECT. When you click on a point on the screen, you''re actually clicking on a whole line between the front of the frustum and the back of the frustum. You can calculate this line using gluUnProject to get the points, then just loop through the objects that could potentially be selected and use line-triangle or line-polygon collision.

I have a demo on my site that allows an object to be dragged in this manner.

Love means nothing to a tennis player

My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)

Share this post


Link to post
Share on other sites