istereo
annotate src/glutmain.c @ 24:70309d71c899
added the texture translation
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Thu, 08 Sep 2011 03:06:46 +0300 |
parents | 557d86c8d7ed |
children | 3d933b796ad2 |
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@24 | 42 |
nuclear@1 | 43 void keyb(unsigned char key, int x, int y) |
nuclear@1 | 44 { |
nuclear@1 | 45 switch(key) { |
nuclear@1 | 46 case 27: |
nuclear@1 | 47 exit(0); |
nuclear@1 | 48 |
nuclear@24 | 49 case 's': |
nuclear@24 | 50 stereo = !stereo; |
nuclear@24 | 51 break; |
nuclear@24 | 52 |
nuclear@24 | 53 case '`': |
nuclear@24 | 54 { |
nuclear@24 | 55 int xsz = glutGet(GLUT_WINDOW_WIDTH); |
nuclear@24 | 56 int ysz = glutGet(GLUT_WINDOW_HEIGHT); |
nuclear@24 | 57 |
nuclear@24 | 58 glutReshapeWindow(ysz, xsz); |
nuclear@24 | 59 } |
nuclear@24 | 60 break; |
nuclear@24 | 61 |
nuclear@1 | 62 default: |
nuclear@1 | 63 break; |
nuclear@1 | 64 } |
nuclear@1 | 65 } |