istereo

annotate src/glutmain.c @ 36:834503dcb486

fixed the rotated gui problem
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 09 Sep 2011 10:25:03 +0300
parents 70309d71c899
children e60f9d8af28d
rev   line source
nuclear@1 1 #include <stdio.h>
nuclear@1 2 #include <stdlib.h>
nuclear@1 3 #include <GL/glew.h>
nuclear@1 4 #include <GL/glut.h>
nuclear@1 5 #include "sanegl.h"
nuclear@2 6 #include "istereo.h"
nuclear@2 7 #include "sdr.h"
nuclear@1 8
nuclear@1 9 void disp(void);
nuclear@1 10 void keyb(unsigned char key, int x, int y);
nuclear@1 11
nuclear@1 12 int main(int argc, char **argv)
nuclear@1 13 {
nuclear@1 14 glutInit(&argc, argv);
nuclear@24 15 glutInitWindowSize(960, 640);
nuclear@1 16 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
nuclear@1 17 glutCreateWindow("test");
nuclear@1 18
nuclear@1 19 glutDisplayFunc(disp);
nuclear@1 20 glutIdleFunc(glutPostRedisplay);
nuclear@1 21 glutReshapeFunc(reshape);
nuclear@1 22 glutKeyboardFunc(keyb);
nuclear@1 23
nuclear@2 24 glewInit();
nuclear@2 25
nuclear@2 26 if(init() == -1) {
nuclear@2 27 return 1;
nuclear@2 28 }
nuclear@2 29
nuclear@1 30 glutMainLoop();
nuclear@1 31 return 0;
nuclear@1 32 }
nuclear@1 33
nuclear@1 34 void disp(void)
nuclear@1 35 {
nuclear@2 36 redraw();
nuclear@1 37
nuclear@1 38 glutSwapBuffers();
nuclear@1 39 }
nuclear@1 40
nuclear@24 41 extern int stereo;
nuclear@31 42 extern int use_bump;
nuclear@24 43
nuclear@1 44 void keyb(unsigned char key, int x, int y)
nuclear@1 45 {
nuclear@1 46 switch(key) {
nuclear@1 47 case 27:
nuclear@1 48 exit(0);
nuclear@1 49
nuclear@24 50 case 's':
nuclear@24 51 stereo = !stereo;
nuclear@24 52 break;
nuclear@24 53
nuclear@31 54 case 'b':
nuclear@31 55 use_bump = !use_bump;
nuclear@31 56 break;
nuclear@31 57
nuclear@24 58 case '`':
nuclear@24 59 {
nuclear@24 60 int xsz = glutGet(GLUT_WINDOW_WIDTH);
nuclear@24 61 int ysz = glutGet(GLUT_WINDOW_HEIGHT);
nuclear@24 62
nuclear@24 63 glutReshapeWindow(ysz, xsz);
nuclear@24 64 }
nuclear@24 65 break;
nuclear@24 66
nuclear@1 67 default:
nuclear@1 68 break;
nuclear@1 69 }
nuclear@1 70 }