View Full Version : how to pin mouse in center of screen?

02-12-2011, 08:46 AM
Hi everyone...
I want to pin my mouse in middle of screen I mean when user move mouse the only thing that he see is rotation in enviroment also mouse curser never reach window border ...

I want to handle my camera with mouse but when mouse reach window border or in full screen mode screen border the mouse position dont change but camera should still rotate slow or speedy depend on speed of mouse movement...

how should i solve this problem?

thank you

02-12-2011, 10:03 AM
what OpenGL underlying library are you using ? For glut I'm not sure if it's possible, but try to see at freeglut website. For windows, X11, try to google "warp pointer".

02-12-2011, 10:29 AM
GLFW allow to do this.

02-12-2011, 11:47 AM
I try GLUT ... so I should use GLFW?

Stuart McDonald
02-14-2011, 08:27 AM
I used to use GLUT and switched to GLFW since I find it to be a nice interface, but you can do what you want in either. I solved a similar problem. I wanted the cursor to be clamped within a circle in the center of screen. Depending on where the cursor was it would change the view accordingly. I disabled the cursor and instead showed a line drawn from the center to the clamped position (I also slowy re-centered the cursor if it was close to the middle so the user could get back to flying straight).

To hide the cursor

To warp the cursor to a screen position

02-15-2011, 09:01 AM