Results 1 to 2 of 2

Thread: how to use glutGetModifiers

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2004

    how to use glutGetModifiers

    below is my code for my game which is my assignment however i wish to make a coding for the character to walk forward when press w and Shift w for running and i use the code below however no matter what i do it will only walk and not run did i use the functions correctly?

    if (glutGetModifiers() == GLUT_ACTIVE_SHIFT)
    RunForward(); //turn forward

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001

    Re: how to use glutGetModifiers

    If you look at the glut documentation you will notice that the function returns a bitmask, so you should use something like:

    Code :
      if( glutGetModifiers() & GLUT_ACTIVE_SHIFT))
    Have you tried to find the problem yourself ? does the glutGetModifiers() function always return GLUT_ACTIVE_SHIFT or what ? are you sure that your own code works (the run vs. the walk code).

    And notice:
    "This routine may only be called while a keyboard, special, or mouse callback is being handled"


Similar Threads

  1. glutGetModifiers
    By malancha in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 03-30-2004, 07:05 PM
  2. glutGetModifiers();?
    By RobertSI in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-04-2000, 06:34 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