This is a 3D model of a keyboard (specifically a 60% layout).
All non-modifier keys are able to be pressed/released by their corresponding key input.
As glutGetModifiers() can only be called when a callback is generated, mapping modifier keys (SHIFT, CTRL, ALT) to actual inputs is a bit tricky. Instead, I've given SHIFT/CTRL/ALT alternate features to modify the scene.
-
Pressing SHIFT + any key will toggle key lighting
-
Pressing ALT + any key will toggle a backlight for the keys.
-
Pressing CTRL + any key will toggle labels for the keys.
-
CAPSLOCK, while being a modifier key, does not have functionality. According to the documentation for glutGetModifers(), while CAPSLOCK is enabled, GLUT_ACTIVE_SHIFT (the modifier key state when SHIFT is pressed) should be returned. However, CAPSLOCK does not appear to be returning this modifier state on my machine.
Screenshots of the program:
GETTING THIS TO WORK
I do not include all the files needed to run this program.
A visual studio solution with all needed additional files can be found here:
http://web.engr.oregonstate.edu/~mjb/cs450/Sample2019.zip
Copy all of the files in this repo into the SampleFreeGlut2019 folder.
glslprogram.cpp will needed to be added as a source file in VS (Right click 'Source Files' -> Add -> Existing Item)