PDA

View Full Version : Need help with getting coordinate using mouse



Swift
08-06-2002, 09:06 PM
Is there a method in graphic library that would return the exact coordinates of the graphic in window?

Niftybitz
08-07-2002, 12:02 AM
Strange question. Why won't you rephrase it, cuz i don't think people know what you mean. If getting the mouse coordinates from the screen is what you're after: under Windows environment you do the following (C++):

POINT pt;
GetCursorPos(&pt);

pt.x=mouse x coordinate
pt.y=mouse y coordinate

Ciao,

Niftybitz.

Swift
08-07-2002, 04:20 PM
Thank for your help and advice on the way I phrase my question. http://www.opengl.org/discussion_boards/ubb/smile.gif

Swift
08-07-2002, 06:57 PM
Actually, I could get the coordinate of the window. However, I would like to know whether the mouse cursor is on the shape that I have draw using openGL.

Swift
08-07-2002, 07:02 PM
Actually, I could get the window coordinate whenever the mouse is pressed. However, is there any calulation or method to get the device coordinate?

Gavin
08-07-2002, 11:39 PM
hmmm so you ideally want to know if the mouse if over an opengl drawn object/poly. OpenGL can handle picking, I am sure there is a nehe tutorial on it.

Swift
08-11-2002, 03:46 PM
Thank for all the help ... With your help, I have just solve my problem http://www.opengl.org/discussion_boards/ubb/smile.gif