Advertisement

Selecting an object

Started by December 14, 2003 06:11 PM
4 comments, last by heathcliff17 21 years, 2 months ago
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
Peace, Love and Rabid Chipmunks - B :-P
You could try making the screen not flash, and make the object be selected when it''s clicked.
Advertisement
yeah that is what I am trying to do. I don''t want the screen to flash ... it just does that...

Peace, Love and Rabid Chipmunks - B :-P
Peace, Love and Rabid Chipmunks - B :-P
Are you setting glRenderMode to GL_SELECT?

[edited by - Thorin_nz on December 14, 2003 7:43:16 PM]
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]
Peace, Love and Rabid Chipmunks - B :-P
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!)

This topic is closed to new replies.

Advertisement