istereo2

annotate src/glutmain.c @ 8:661bf09db398

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