Detecting key events

glut seems to support only a limited number of key events. I want to detect key state for the shift key, control, alt, etc, in order to be able to detect a shift-click, for example.

Is there any way to do this in glut, and if not, does anyone have portable X code to do it, that I can encapsulate since there is obviously equivalent windows code to do it on that platform…


Use glutGetModifiers.

This will allow you to detect Shift, Ctrl, and Alt. Unfortunately, to the best of my knowledge it only allows you to detect one of them at a time – there’s no way to detect a Shift-Ctrl-Click, for example.

If you do find a way to handle multiple simultaneous modifiers, please post it here.

Try GLFW . It has all the keyboard support you can dream of (?) :smiley:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.