Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: how to pin mouse in center of screen?

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    13

    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

  2. #2
    Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    466

    Re: how to pin mouse in center of screen?

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

  3. #3
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: how to pin mouse in center of screen?

    GLFW allow to do this.

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    13

    Re: how to pin mouse in center of screen?

    I try GLUT ... so I should use GLFW?

  5. #5
    Junior Member Regular Contributor
    Join Date
    Jun 2006
    Location
    Edinburgh - Scotland
    Posts
    147

    Re: how to pin mouse in center of screen?

    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
    glutSetCursor(GLUT_CURSOR_NONE);
    glfwDisable(GLFW_MOUSE_CURSOR);

    To warp the cursor to a screen position
    glutWarpPointer(x,y);
    glfwSetMousePos(x,y);


  6. #6
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    13

    Re: how to pin mouse in center of screen?

    Thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •