GLUT keyboard and mouse func separated

This is a discussion on GLUT keyboard and mouse func separated within the Game Programming forums, part of the General Programming Boards category; I am programming a simple 3D model viewer. It works like a charm as far as 3D goes, but the ...

  1. #1
    Lode Runner
    Join Date
    May 2004
    Posts
    53

    GLUT keyboard and mouse func separated

    I am programming a simple 3D model viewer. It works like a charm as far as 3D goes, but the controls are more than edgy.

    To keep it simple, I used the glut keyboard and mouse callbacks to establish a first-person-like camera movement (imagine any FPS while underwater, you'll get the idea). They both work the way I intended separately, but I have two problems.

    1. The callbacks are mutually exclusive. I have to "turn" (mouse) or "walk" (keyboard). Is there any way to have them work at the same time ? Or at least in fast alternance, so that both are usable.

    2. Is there any way to accelerate the "callback rate", i.e. the time between two calls to the keyboard and mouse functions ?

    Keep in mind that this is a very simple program ; I have neither time nor reason to use an input lib like DirectInput or SDL. However, since this viewer is not for me, I hope to deliver a smoother user experience.

  2. #2
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    1. Use variables to maintain state and alter the state in the callbacks, you should have no problem turning and walking at the same time.

    2. The callback will be called everytime an event is received. I don't think you can speed it up but i dont see why you'd want too. I get perfectly smooth movement using the GLUT callbacks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detecting keyboard and mouse in linux
    By sameer.nalwade in forum C Programming
    Replies: 3
    Last Post: 11-22-2008, 04:24 AM
  2. how to handle keyboard and mouse events for all windows
    By manav-II in forum Windows Programming
    Replies: 3
    Last Post: 08-25-2008, 10:03 AM
  3. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 04:34 PM
  4. Mouse & keyboard deactivate for some seconds?
    By JoJo in forum Windows Programming
    Replies: 0
    Last Post: 09-08-2001, 01:18 PM
  5. Replies: 0
    Last Post: 09-08-2001, 07:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21