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