Jump to content
  • Advertisement

Archived

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

NnN

Where the mouse is pointing?

This topic is 5707 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

Hi, Is there away to know where the mouse is pointing without having any of it buttons pressed?? Thank you!

Share this post


Link to post
Share on other sites
Advertisement
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!!

Share this post


Link to post
Share on other sites
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)?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!