Modifier Key Input Question


I have been trying to find a way for OpenGL to recognize a the use of a single modifier key. The function glutGetModifiers() will only work if some other input is called at the same time.

A simple example of what I am looking for could be a feature in photoshop / gimp, where when the user is in the line draw state, they can hold down the shift key, and the line becomes orthogonal.

Is there any way to accomplish this in OpenGL?


Technically, glut is not OpenGL.
Glut is good to start with, until you need some special feature that is not provided.

You can use any other event handler system, GLFW, wxWidgets, …
Or even low level platform dependent APIs.

Is it possible to use GLUT and GLFW in conjunction? (i.e. Have a program written with GLUT, and has GLFW running along side of it for user input). Or would such a thing be unadvised?


I’m not sure why you would want to, since GLUT has input functionality, but in general no. Input comes to a particular window, so GLFW has to either control the window or be given it in order for that to work. And I’m fairly sure that FreeGLUT doesn’t have a way to get its platform-specific window object (and no, glutGetWindow doesn’t count), nor does GLFW have a way to give it a platform-specific window object.