istereo
view src/glutmain.c @ 29:fb4c9641059f
added more forgotten files
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Thu, 08 Sep 2011 08:31:15 +0300 |
parents | 557d86c8d7ed |
children | 3d933b796ad2 |
line source
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <GL/glew.h>
4 #include <GL/glut.h>
5 #include "sanegl.h"
6 #include "istereo.h"
7 #include "sdr.h"
9 void disp(void);
10 void keyb(unsigned char key, int x, int y);
12 int main(int argc, char **argv)
13 {
14 glutInit(&argc, argv);
15 glutInitWindowSize(960, 640);
16 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
17 glutCreateWindow("test");
19 glutDisplayFunc(disp);
20 glutIdleFunc(glutPostRedisplay);
21 glutReshapeFunc(reshape);
22 glutKeyboardFunc(keyb);
24 glewInit();
26 if(init() == -1) {
27 return 1;
28 }
30 glutMainLoop();
31 return 0;
32 }
34 void disp(void)
35 {
36 redraw();
38 glutSwapBuffers();
39 }
41 extern int stereo;
43 void keyb(unsigned char key, int x, int y)
44 {
45 switch(key) {
46 case 27:
47 exit(0);
49 case 's':
50 stereo = !stereo;
51 break;
53 case '`':
54 {
55 int xsz = glutGet(GLUT_WINDOW_WIDTH);
56 int ysz = glutGet(GLUT_WINDOW_HEIGHT);
58 glutReshapeWindow(ysz, xsz);
59 }
60 break;
62 default:
63 break;
64 }
65 }