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 5 of 5

Thread: glut mouse coordinates

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    11

    glut mouse coordinates

    Hello Everyone!

    I have a short question on mouse beaviour in glut. I want to have a rolling ball in my game that the user can control directly by mouse movement like in the atari st game oxyd. Now my problem is that when I hide the mouse, there's still the screen bounderies, meaning that I can only detect mouse movement _within_ the screen or window.
    Is it somehow possible in glut to get relative mouse coordinates or to set the mouse coordinates back to the center abter reading them?
    And if it isn't, could I do it via DirectInput?

    thanks a lot in advance

    Robin

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    668

    Re: glut mouse coordinates

    Have a search on this list as this has been answered before... but I can't remember what the answer is!

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    11

    Re: glut mouse coordinates

    Thanks, I found it!
    I used glutWarpPointer and after a few problems it works just fine.
    great discussion board!

  4. #4
    Junior Member Regular Contributor
    Join Date
    Oct 2002
    Location
    King George, Virginia
    Posts
    138

    Re: glut mouse coordinates

    one handy technique is to, at the start of your application, turn off the cursor and move the mouse to the center of your scene. then, each frame, find out how much the mouse moved, then move it back to the center. great for time-based input, and you never have to deal with the window boundaries.

    jebus

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    11

    Re: glut mouse coordinates

    That was my first approach.
    When it turned out to be a bit troublesome I let the mouse move and only move it back if it comes too close to the boundaries.
    But maybe I'll change it back again. I found the error and now it should also work the way you described. Seems to be easier and also the common way.
    (When you press Alt+Tab while playing Counterstrike and then go back to the game you can sometimes see the mouse cursor flickering around the center of the screen.)

    greetz
    robin

Posting Permissions

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