PDA

View Full Version : mouse and keyboard control using GLUT.



09-06-2003, 06:27 AM
Hi!

I drew a scene and then tried to move around in it in real time, so I put a "switch" and then a bunch of "cases" for keys and let the glutKeyboradFunc do the work, using gluLookAt, changing the values of variables in it. It works pretty bad. First of all, glut works only with ASCII keys, which exclude arrows. secondly, you have to put gluLookAt into IdleFunc for constant update. Is there a better way to move around in real time, or do I have to use MFC?

Deiussum
09-06-2003, 08:11 AM
For the extended keyboard keys, use glutSpecialFunc. This should notify you of keypresses for the arrows, function keys, etc.

09-06-2003, 09:52 AM
There's also glutKeyboardUpFunc and glutSpecialUpFunk that register when keys are released if you wanted to use a boolean array for the keys. I recomend opening the glut file so you can get a good idea of all the relevant commands at your disposal.