Results 1 to 5 of 5

Thread: Is there a way to get mickeys in GLUT?

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    San Jose, CA, USA
    Posts
    3

    Is there a way to get mickeys in GLUT?

    I'm trying to convert code from DirectInput to GLUT, so that I can run it on Windows NT. But as far as I can tell, GLUT only supports screen coordinates, not mickeys. This is all fine and dandy, because I can just keep track of the last X and Y coordinates, and do a difference. But, I need a way to reset the X and Y coordinates. Otherwise, a user could move the mouse to the edge of the screen, and then the mouse would just seem to stop working.

    Note, I'm not using the mouse like a cursor, I'm using it for rotating cameras, so it needs to be infinite in scope, i.e. not confined to a window. I need to be able to scroll it in any direction indefinitely. Can this be done with GLUT?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    184

    Re: Is there a way to get mickeys in GLUT?

    you can use glutSetCursor(GLUT_CURSOR_NONE) to make the cursor invisible. glutWarpPointer(x,y) will move the cursor to the window coordinate specified. for good infinite mouse movement, use time based input. start out moving the cursor to the center of the window, then every frame, calc how far the cursor moved in x and y directions, then move the cursor back to the center of the screen.

    b

    BTW: what in the he!! is a mickey?!?

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    San Jose, CA, USA
    Posts
    3

    Re: Is there a way to get mickeys in GLUT?

    Originally posted by coredump:

    BTW: what in the he!! is a mickey?!?
    If you programmed IBM-compatible PCs 10-15 years ago, this is the documentation you came to know and love: Ralph Brown's interrupt list.
    INT 33 - MS MOUSE v1.0+ - READ MOTION COUNTERS
    AX = 000Bh
    Return: CX = number of mickeys mouse moved horizontally since last call
    DX = number of mickeys mouse moved vertically
    Notes: a mickey is the smallest increment the mouse can sense
    positive values indicate down/right
    SeeAlso: AX=0003h,AX=001Bh,AX=0027h

    For the new generation of kids - from the Microsoft Visual Studios 6 documentation:
    Remember, GetDeviceState does not report the position of the cursor relative to either the screen or the window; it reports the travel of the mouse (in "mickeys," a mickey being the smallest movement of the mouse that can be recorded). In other words, if the cursor reaches the edge of the screen but the user keeps pushing the mouse in that direction, the axis values reported by GetDeviceState keep changing. If the user has mouse acceleration turned on, moving the Windows cursor a given distance may take more or fewer mickeys, depending on when acceleration kicks in.

    Anyway, thanks for the info. That sounded like exactly what I was looking for.

  4. #4
    Member Contributor
    Join Date
    Apr 2000
    Location
    Hoegaarden, Belgium
    Posts
    71

    Re: Is there a way to get mickeys in GLUT?

    for a moment i thought you wanted to draw mickey mouse using a single glut function... (like a teapot)
    You can easly simulate this behaviour by storing the last mouse position an substracting the current. Voila, the needed relative mouse position.

    MtPOI

  5. #5
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    San Jose, CA, USA
    Posts
    3

    Re: Is there a way to get mickeys in GLUT?

    Originally posted by masterpoi:
    for a moment i thought you wanted to draw mickey mouse using a single glut function... (like a teapot)
    You can easly simulate this behaviour by storing the last mouse position an substracting the current. Voila, the needed relative mouse position.

    MtPOI

    Yes, but what happens when the mouse hits the edge of the screen? Have you ever played one of those GLUT-based games where you can only turn so far in each direction?

    Imagine Quake where you can only turn 360 degrees, and you have to turn back 350 degrees to the right just to turn 10 degrees to the left. And what about when someone finds this "weak spot"/direction, and tries to stay in the area so that you constantly have to whip around back and forth just to shoot at someone who takes one step to the left and one to the right over and over.

Similar Threads

  1. glut.h not found after installing glut
    By SagoO in forum OpenGL: General
    Replies: 8
    Last Post: 11-13-2010, 08:04 PM
  2. Timers - time.h or GLUT timerfunc? GLUT or SDL..?
    By omdown in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 12-16-2009, 12:27 PM
  3. Using GLUT meshes without GLUT window
    By Dwight in forum OpenGL: General
    Replies: 2
    Last Post: 11-25-2008, 03:06 AM
  4. glut teapot do i need to initialize glut?
    By bansheeogl in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-01-2005, 04:21 AM
  5. Subwindows in GLUT - New section available in the GLUT tutorial
    By Antonio in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-13-2000, 10:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean