istereo

view src/glutmain.c @ 31:3d933b796ad2

added datafie pull
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 08 Sep 2011 15:06:40 +0300
parents 70309d71c899
children e60f9d8af28d
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;
42 extern int use_bump;
44 void keyb(unsigned char key, int x, int y)
45 {
46 switch(key) {
47 case 27:
48 exit(0);
50 case 's':
51 stereo = !stereo;
52 break;
54 case 'b':
55 use_bump = !use_bump;
56 break;
58 case '`':
59 {
60 int xsz = glutGet(GLUT_WINDOW_WIDTH);
61 int ysz = glutGet(GLUT_WINDOW_HEIGHT);
63 glutReshapeWindow(ysz, xsz);
64 }
65 break;
67 default:
68 break;
69 }
70 }