Advertisement

glut keys

Started by July 05, 2001 12:57 AM
1 comment, last by Eber Kain 23 years, 7 months ago
where can i find a listing of what all the keys #''s are. i know 27 is (esc), but i need to know some other, like the arrow keys, and ctrl/shift/alt home.earthlink.net/~eberkain/
www.EberKain.comThere it is, Television, Look Listen Kneel Pray.
You can look in the header file. GLUT has a function for getting the status of some keys like ctrl. I think the name is glutGetModifier.
Advertisement
Arrow keys and keys like Page Down/Page Up/Home/End are handled in a different function that normal keyboard commands. Ordinarily, keys like 'a' and 'b' would be directed to the function you provide in the glutKeyboardFunc(...) function, they're going to go to the function in the glutSpecialFunc(...) command.

For example, here's how I handled that problem...

  void keyboard2GL(int key, int x, int y){	if(key == GLUT_KEY_LEFT) xdir -= 2.0f / zoom;	else if(key == GLUT_KEY_RIGHT) xdir += 2.0f / zoom;	else if(key == GLUT_KEY_DOWN) ydir -= 2.0f / zoom;	else if(key == GLUT_KEY_UP) ydir += 2.0f / zoom;	else if(key == GLUT_KEY_HOME) {xdir -= 2.0f / zoom;	ydir += 2.0f / zoom;}	else if(key == GLUT_KEY_END)  {xdir -= 2.0f / zoom;	ydir -= 2.0f / zoom;}	else if(key == GLUT_KEY_PAGE_UP)    {xdir += 2.0f / zoom;	ydir += 2.0f / zoom;}	else if(key == GLUT_KEY_PAGE_DOWN)  {xdir += 2.0f / zoom;	ydir -= 2.0f / zoom;}}void createWindow(void* arg){	// Code goes here...	glutKeyboardFunc(keyboardGL);	glutSpecialFunc(keyboard2GL);	// More code goes here...	glutMainLoop();}   


Hope this helps! :D

~ Dragonus

Edited by - Dragonus on July 9, 2001 4:37:48 PM

This topic is closed to new replies.

Advertisement