View Full Version : about glut keyboard routine
02-25-2005, 06:31 AM
Can anyone tell me how can we press 2 keys at the same time using glut. I have some code that we can press without glut. But I want to do that with glut.
02-25-2005, 11:35 AM
I should check the documentation about GLUT
Nate\'s homepage (http://www.xmission.com/~nate/opengl.html)
The Redbook 1.2 speak about GLUT i think, there is an online version of the book here
03-01-2005, 06:56 AM
I have checked there but, it explains only routines. I have read some part of the red book.
It also uses examples with glut but i can't press 2 keys at the same time. Can glut achieve this or not... any ideas?
Well it depends on which two keys. If you want a usual combination like Alt+K for example, there's glutGetModifiers() I think, which returns something like GLUT_CTRL, GLUT_ALT etc. Check it out.
Another idea, would be to have a timer that checks the time between the 2 keypresses. If it is under a certain threshhold then, you can say that they're pressed together.
I read it in another post today here and I guess I need to re-iterate: glut is used to help someone learn OpenGL (well, and then some) but if you want to do really serious stuff you should go with the OS's windowing system. Good luck!
Go here http://www.lighthouse3d.com/opengl/glut/index.php?7
maybe it will help you.
And read the glut.h file. It is easy to understand.
03-02-2005, 01:05 PM
Well i don't want a combination like alt+K. A timer threshold is not useful for me because i will implement a kind of game. For example you will go forward when pressing 'w' key and you will be able to turn at the same time when you press 'a' key. I think moucard is right.I should go with the OS's windowing system. I just wanted to use glut because opengl is a little bit easier
when you use glut library. Code is easier to understand.
Naah don't worry, after a few weeks in an API you'll start feeling comfortable with it. God knows DirectX can look ugly but after a while you get used to names like PFNKEYBOARDCALLBACK etc.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.