13 static void display();
15 static void reshape(int x, int y);
16 static void key_press(unsigned char key, int x, int y);
17 static void key_release(unsigned char key, int x, int y);
18 static void mouse(int bn, int st, int x, int y);
20 static unsigned int start_time;
22 int main(int argc, char **argv)
24 glutInitWindowSize(1024, 768);
25 glutInit(&argc, argv);
26 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_MULTISAMPLE);
27 glutCreateWindow("demo");
29 glutDisplayFunc(display);
31 glutReshapeFunc(reshape);
32 glutKeyboardFunc(key_press);
33 glutKeyboardUpFunc(key_release);
35 glutMotionFunc(app_mouse_motion);
36 glutPassiveMotionFunc(app_mouse_motion);
47 void app_swap_buffers()
65 start_time = glutGet(GLUT_ELAPSED_TIME);
71 time_msec = glutGet(GLUT_ELAPSED_TIME) - start_time;
80 static void reshape(int x, int y)
88 static void key_press(unsigned char key, int x, int y)
90 app_keyboard(key, true);
93 static void key_release(unsigned char key, int x, int y)
95 app_keyboard(key, false);
98 static void mouse(int bn, int st, int x, int y)
100 int bidx = bn - GLUT_LEFT_BUTTON;
101 bool down = st == GLUT_DOWN;
103 app_mouse_button(bidx, down, x, y);