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

Thread: Strange behavior in GLUT Key Up/down

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    4

    Strange behavior in GLUT Key Up/down

    Hi gang,

    I wish to detect key-press / release for as many simultaneous keys as possible at a given instant of time only using GLUT api.

    I have used c++ code that looks like :

    /*usual code replaced by ... for simplicity*/

    /*...*/

    void keyPressed(unsigned char key, int x, int y) {cout << "pressed " << key << endl;}

    void keyReleased(unsigned char key, int x, int y) {cout << "released " << key << endl;}

    /*...*/

    int main(int argc, char **argv){
    /*...*/

    glutIgnoreKeyRepeat(1);
    glutKeyboardFunc(&keyPressed);
    glutKeyboardUpFunc(&keyReleased);

    /*...*/

    glutMainLoop();
    }

    Tried this on win2K PC with VC++6.0 GLUT API ver 3. This works as expected as long as I press keys on a single row of the keyboard.

    Example: (simultaneoulsy )a,s,d,f,g,h,j,k,l,;,' pressed and released in any order are detected properly.
    But, pressing (simultaneoulsy ) a,s,z,d 'z' goes undetected.

    And lots of such similar combinations where things can go wrong exist.

    Any ideas?

    Thanks for reading till this point

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    857

    Re: Strange behavior in GLUT Key Up/down

    The toolkits forum is more appropriate for this post...

    -- Tom

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Strange behavior in GLUT Key Up/down

    Clicky .

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    4

    Re: Strange behavior in GLUT Key Up/down

    Thanks a lot. That really helped me.

    I was getting doubtful that GLUT api was flawed. I tested out with the more specific case of Win API GetAsyncKeyState. Same problem exists.

    so, Keyboards ARE evil

Posting Permissions

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