istereo2

view src/glut/main.c @ 33:3784a2d4bed5

more ad fuckery
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 10 Oct 2015 16:38:19 +0300
parents 2b85d05df3f2
children
line source
1 /*
2 Stereoscopic tunnel for iOS.
3 Copyright (C) 2011-2015 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>
24 #ifdef __APPLE__
25 #include <GLUT/glut.h>
26 #else
27 #include <GL/glut.h>
28 #endif
30 #include "sanegl.h"
31 #include "istereo.h"
32 #include "sdr.h"
34 void disp(void);
35 void keyb(unsigned char key, int x, int y);
36 void mouse(int bn, int st, int x, int y);
37 void motion(int x, int y);
39 int main(int argc, char **argv)
40 {
41 glutInit(&argc, argv);
42 glutInitWindowSize(920, 640);
43 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
44 glutCreateWindow("test");
46 glutDisplayFunc(disp);
47 glutIdleFunc(glutPostRedisplay);
48 glutReshapeFunc(reshape);
49 glutKeyboardFunc(keyb);
50 glutMouseFunc(mouse);
51 glutMotionFunc(motion);
53 glewInit();
55 if(init() == -1) {
56 return 1;
57 }
59 glutMainLoop();
60 return 0;
61 }
63 void disp(void)
64 {
65 redraw();
67 glutSwapBuffers();
68 }
70 extern int stereo;
71 extern int use_bump;
73 void keyb(unsigned char key, int x, int y)
74 {
75 switch(key) {
76 case 27:
77 exit(0);
79 case 's':
80 stereo = !stereo;
81 break;
83 case 'b':
84 use_bump = !use_bump;
85 break;
87 case '`':
88 {
89 int xsz = glutGet(GLUT_WINDOW_WIDTH);
90 int ysz = glutGet(GLUT_WINDOW_HEIGHT);
92 glutReshapeWindow(ysz, xsz);
93 }
94 break;
96 case ' ':
97 playpause();
98 break;
100 case '.':
101 seektime(50);
102 break;
103 case '>':
104 seektime(10);
105 break;
106 case ']':
107 seektime(1);
108 break;
110 case ',':
111 seektime(-50);
112 break;
113 case '<':
114 seektime(-10);
115 break;
116 case '[':
117 seektime(-1);
118 break;
120 case '1':
121 glutReshapeWindow(960, 640); /* 3.5 inch iphone */
122 break;
124 case '2':
125 glutReshapeWindow(1136, 640); /* 4.0 inch iphone */
126 break;
128 case '3':
129 glutReshapeWindow(1334, 750); /* 4.7 inch iphone */
130 break;
132 case '4':
133 glutReshapeWindow(2208, 1242); /* 5.5 inch iphone */
134 break;
136 case '5':
137 glutReshapeWindow(2048, 1496); /* ipad2? */
138 break;
140 case '9':
141 glutReshapeWindow(1104, 621); /* hald 5.5 inch iphone */
142 break;
144 case '0':
145 glutReshapeWindow(1024, 748); /* half ipad2 */
146 break;
148 default:
149 break;
150 }
151 }
153 void mouse(int bn, int st, int x, int y)
154 {
155 mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN ? 1 : 0, x, y);
156 }
158 void motion(int x, int y)
159 {
160 mouse_motion(x, y);
161 }
163 /* dummy ad banner functions */
164 void ad_banner_show(void)
165 {
166 }
168 void ad_banner_hide(void)
169 {
170 }