Original Post
🔒 Locked
Closing GLUT windows
Advertisement
Use the glut function glutKeyboardFunc() with the name of the function calling on withing the brackets.
eg
void Keyboard(unsigned char key, int x, int y)
{
// use a case statement when you use multiple keys
if(key == 'q') exit(0);
}
int main( int argc, char* argv[] )
{
// all of your draw commands
glutKeyboardFunc(Keyboard);
// glutDisplayFunc here
glutMainLoop();
return 0;
}
Hope that helps
I would highly suggest you get a copy of the RedBook (OpenGL Programming Guide) which uses GLUT throughout the entire book.
Also download the GLUT specifications from opengl.org. That will help also.
[edited by - auLucifer on January 15, 2004 6:52:34 PM]
eg
void Keyboard(unsigned char key, int x, int y)
{
// use a case statement when you use multiple keys
if(key == 'q') exit(0);
}
int main( int argc, char* argv[] )
{
// all of your draw commands
glutKeyboardFunc(Keyboard);
// glutDisplayFunc here
glutMainLoop();
return 0;
}
Hope that helps
I would highly suggest you get a copy of the RedBook (OpenGL Programming Guide) which uses GLUT throughout the entire book.
Also download the GLUT specifications from opengl.org. That will help also.
[edited by - auLucifer on January 15, 2004 6:52:34 PM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement