Search code examples
c++inputkeyboardglut

OpenGL / Glut Buttons and Keys


I'm trying to make a simple square move, but before I get ahead of myself I need to be sure I understand what keys are built into Glut.

I'm aware of the following keys:

  • GLUT_KEY_F1, GLUT_KEY_F2, ..., GLUT_KEY_F12 - F1 through F12 keys
  • GLUT_KEY_PAGE_UP, GLUT_KEY_PAGE_DOWN - Page Up and Page Down keys
  • GLUT_KEY_HOME, GLUT_KEY_END - Home and End keys
  • GLUT_KEY_LEFT, GLUT_KEY_RIGHT, GLUT_KEY_UP, GLUT_KEY_DOWN - Arrow keys
  • GLUT_KEY_INSERT - Insert key

But are there any more? eg, for all keys on a keyboard and mouse?


Solution

  • glut divides key in keyboard by glutSpecialFunc w/c takes special keys such as F1,F2..., NUMPADS, etc. while glutKeyboardFunc takes all keys that can be represented by a character like the alphabets, numbers, ESC (27 in 'ASCII'), ENTER (32 in 'ASCII'), etc.

    in summary, glutKeyboardFunc take char parameters that can be represented without using any '\' (backslash, like '\t', '\n') before any character the rest are handled by glutSpecialFunc