Where the mouse is pointing?

Started by
5 comments, last by NnN 21 years, 4 months ago
Hi, Is there away to know where the mouse is pointing without having any of it buttons pressed?? Thank you!
Advertisement
You could use the function GetCursorPos().
Hi,
How do I use GetCursorPos in an OpenGL program? (I have no experience in windows programming) I tried to call it in the mouse function and made my test on the pointer.x & pointer.y to see if they are in some area then I wanted to display something (in the display function depending on some boolean variables changed after testing pointer.x & .y) but it didn''t work, Any help?
Thanks!!
Hard to say - might be something else going wrong. One thing to keep in mind is that GetCursorPos always returns coordinates in screen space - maybe you''re testing locations in a different coordinate system (client space, your own OpenGL coords, etc)?
Find what it is at program start, and any changes keep track of what the new position is. I think anytime you change the video mode, the mouse re-centers. Just a though, I haven''t payed that much attention.
"Ogun's Laughter Is No Joke!!!" - Ogun Kills On The Right, A Nigerian Poem.
Hi,
I''ve fixed my program so now when I point the mouse where I want it to be it makes everything good except one problem.. Flickering!! It''s flickering really bad because I added glutPostRedisplay(); after the condition for checking the mouse coordinate so it will actullay show the result.. If I remove glutPostRedisplay(); there will be no flickering but it wouldn''t show the changes I want it to make. So is there a better way to do this??
Thank you!
i never use glutPostRedisplay
but anyways just keep track of where the mouse is like so

int global_mouse_pos_x;

void mouse_move( int x, inty ) // this is the glut callback
{
global_mouse_pos_x = x;
}

i believe there r 3 mouse callbacks possible.
passive mouse, mouse move with a button, mouse event

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

This topic is closed to new replies.

Advertisement