8 static void display(void);
9 static void keypress(unsigned char key, int x, int y);
10 static void skeypress(int key, int x, int y);
11 static void mouse(int bn, int st, int x, int y);
12 static int translate_key(int key);
14 static long start_time;
17 int main(int argc, char **argv)
19 glutInit(&argc, argv);
20 glutInitWindowSize(1280, 800);
21 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
22 glutCreateWindow("Mindlapse");
24 glutDisplayFunc(display);
25 glutIdleFunc(glutPostRedisplay);
26 glutReshapeFunc(demo_reshape);
27 glutKeyboardFunc(keypress);
28 glutSpecialFunc(skeypress);
30 glutMotionFunc(demo_motion);
32 if(demo_init() == -1) {
37 start_time = glutGet(GLUT_ELAPSED_TIME);
42 void swap_buffers(void)
47 static void display(void)
49 time_msec = glutGet(GLUT_ELAPSED_TIME) - start_time;
54 assert(glGetError() == GL_NO_ERROR);
57 static void keypress(unsigned char key, int x, int y)
59 if(key == 27) exit(0);
61 demo_keyboard(key, 1);
64 static void skeypress(int key, int x, int y)
66 if((key = translate_key(key))) {
67 demo_keyboard(key, 1);
71 static void mouse(int bn, int st, int x, int y)
73 int bidx = bn - GLUT_LEFT_BUTTON;
74 int press = st == GLUT_DOWN;
76 demo_mouse(bidx, press, x, y);
79 static int translate_key(int key)
81 if(key >= GLUT_KEY_F1 && key <= GLUT_KEY_F12) {
82 return key - GLUT_KEY_F1 + KEY_F1;
93 case GLUT_KEY_PAGE_UP:
95 case GLUT_KEY_PAGE_DOWN: