how to pin mouse in center of screen?

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

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”.

GLFW allow to do this.

I try GLUT … so I should use GLFW?

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