6 static void display(void);
7 static void idle(void);
8 static void keydown(unsigned char key, int x, int y);
9 static void keyup(unsigned char key, int x, int y);
10 static void mouse(int bn, int st, int x, int y);
12 static long time_start;
14 int main(int argc, char **argv)
16 unsigned int glut_flags = GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH;
18 glutInit(&argc, argv);
21 if(parse_args(argc, argv) == -1) {
24 if(opt.srgb) glut_flags |= GLUT_SRGB;
25 if(opt.msaa) glut_flags |= GLUT_MULTISAMPLE;
27 glutInitWindowSize(opt.width, opt.height);
28 glutInitDisplayMode(glut_flags);
29 glutCreateWindow("Prior Art / Mindlapse");
31 glutDisplayFunc(display);
33 glutReshapeFunc(demo_reshape);
34 glutKeyboardFunc(keydown);
35 glutKeyboardUpFunc(keyup);
37 glutMotionFunc(demo_mmotion);
38 glutPassiveMotionFunc(demo_mmotion);
39 glutSpaceballMotionFunc(demo_sball_motion);
40 glutSpaceballRotateFunc(demo_sball_rotate);
41 glutSpaceballButtonFunc(demo_sball_button);
47 if(demo_init() == -1) {
52 time_start = glutGet(GLUT_ELAPSED_TIME);
63 static void display(void)
65 time_msec = glutGet(GLUT_ELAPSED_TIME) - time_start;
72 static void idle(void)
78 ((key == '\r' || key == '\n') && (glutGetModifiers() & GLUT_ACTIVE_ALT))
81 static void keydown(unsigned char key, int x, int y)
83 static int fullscr = -1, prev_x, prev_y;
86 if(fullscr == -1) fullscr = opt.fullscr;
89 prev_x = glutGet(GLUT_WINDOW_X);
90 prev_y = glutGet(GLUT_WINDOW_Y);
93 glutPositionWindow(prev_x, prev_y);
97 demo_keyboard(key, 1);
100 static void keyup(unsigned char key, int x, int y)
102 demo_keyboard(key, 0);
105 static void mouse(int bn, int st, int x, int y)
107 demo_mbutton(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y);