Jump to content
  • Advertisement
Sign in to follow this  
marti901

OpenGL glutMotionFunc

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

I'm trying to make camera control in OpenGL/glut.

I works fine with the arrow keys.

But i won't work with the mouse because in only updates when in press a moue button.

Now i my question.
Is there a way to get the mouse x, y each time the mouse moves instead of each time there is a button pressed or released?

I use now: glutMotionFunc(MouseMove);

code of MouseMove


void MouseMove(int x, int y){
printf("MouseX = %d\n", x);
Player.HandleMouseMove(x);

glutWarpPointer(SCREEN_WIDTH/2, SCREEN_HEIGHT/2);

}

Share this post


Link to post
Share on other sites
Advertisement
glutMotionFunc indeed only triggers when you move the mouse with a button pressed. You want glutPassiveMotionFunc instead, which triggers at any time you move the mouse as long as the window is in focus. I am not sure if it triggers only when no buttons are pressed, or always triggering on movement, so you may have to use both.

Share this post


Link to post
Share on other sites

glutMotionFunc indeed only triggers when you move the mouse with a button pressed. You want glutPassiveMotionFunc instead, which triggers at any time you move the mouse as long as the window is in focus. I am not sure if it triggers only when no buttons are pressed, or always triggering on movement, so you may have to use both.


That was the problem thxcool.gif

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!