istereo2

view src/glutmain.c @ 2:81d35769f546

added the tunnel effect source
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 19 Sep 2015 05:51:51 +0300
parents
children
line source
1 /*
2 Stereoscopic tunnel for iOS.
3 Copyright (C) 2011 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <GL/glew.h>
23 #include <GL/glut.h>
24 #include "sanegl.h"
25 #include "istereo.h"
26 #include "sdr.h"
28 void disp(void);
29 void keyb(unsigned char key, int x, int y);
31 int main(int argc, char **argv)
32 {
33 glutInit(&argc, argv);
34 glutInitWindowSize(640, 920);
35 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
36 glutCreateWindow("test");
38 glutDisplayFunc(disp);
39 glutIdleFunc(glutPostRedisplay);
40 glutReshapeFunc(reshape);
41 glutKeyboardFunc(keyb);
43 glewInit();
45 if(init() == -1) {
46 return 1;
47 }
49 glutMainLoop();
50 return 0;
51 }
53 void disp(void)
54 {
55 redraw();
57 glutSwapBuffers();
58 }
60 extern int stereo;
61 extern int use_bump;
63 void keyb(unsigned char key, int x, int y)
64 {
65 switch(key) {
66 case 27:
67 exit(0);
69 case 's':
70 stereo = !stereo;
71 break;
73 case 'b':
74 use_bump = !use_bump;
75 break;
77 case '`':
78 {
79 int xsz = glutGet(GLUT_WINDOW_WIDTH);
80 int ysz = glutGet(GLUT_WINDOW_HEIGHT);
82 glutReshapeWindow(ysz, xsz);
83 }
84 break;
86 default:
87 break;
88 }
89 }