Advertisement

get x,y pos and mouse

Started by November 08, 2003 12:39 PM
3 comments, last by dual0 21 years, 4 months ago
Hello I draw an object with tha classic glRotate(...) glTransate(...) glBegin(...) glVertex(..vert1.) glVertex(..vert2.) ... glEnd(...) I want to get x,y pos ver1 to use with mouse func and determine when it is clicked, how can I do taht? thanx
huela
If you''re developing in windows, you can respond to the window events WM_MOUSEMOVE and WM_MOUSEDOWN...

Check the MSDN for more info...
Advertisement
I''am developing under linux, but this was not my question.

I''am able to capture mouse coords with glutMouseFunc(), that give me x,y.
But now I want to determinate witch object I''have fired to?

How can I determinate if mouse (x,y) coords are corrensponding with opengl my object ?


huela
I''ve never actually done it, but the book I just read called "OpenGL, a Primer" by Edward Angel has a section on it. Basically you have to re-render the scene in a special selection mode which allows you to collect hits for a particular clipping region which corresponds to a rectangle around the mouse. Sorry I don''t have more specifics, but maybe this will point you in the right direction.


-sam

thanx, that gave me the the right idea.

see the link, it would explain the job.

http://fly.cc.fer.hr/~unreal/theredbook/chapter12.html

bye
huela

This topic is closed to new replies.

Advertisement