istereo

diff src/glutmain.c @ 2:bb68fac22579

sanegl and shit
author John Tsiombikas <nuclear@mutantstargoat.com>
date Wed, 07 Sep 2011 02:48:35 +0300
parents 4d25539806d2
children 557d86c8d7ed
line diff
     1.1 --- a/src/glutmain.c	Tue Sep 06 12:48:39 2011 +0300
     1.2 +++ b/src/glutmain.c	Wed Sep 07 02:48:35 2011 +0300
     1.3 @@ -3,9 +3,10 @@
     1.4  #include <GL/glew.h>
     1.5  #include <GL/glut.h>
     1.6  #include "sanegl.h"
     1.7 +#include "istereo.h"
     1.8 +#include "sdr.h"
     1.9  
    1.10  void disp(void);
    1.11 -void reshape(int x, int y);
    1.12  void keyb(unsigned char key, int x, int y);
    1.13  
    1.14  int main(int argc, char **argv)
    1.15 @@ -20,41 +21,23 @@
    1.16  	glutReshapeFunc(reshape);
    1.17  	glutKeyboardFunc(keyb);
    1.18  
    1.19 +	glewInit();
    1.20 +
    1.21 +	if(init() == -1) {
    1.22 +		return 1;
    1.23 +	}
    1.24 +
    1.25  	glutMainLoop();
    1.26  	return 0;
    1.27  }
    1.28  
    1.29  void disp(void)
    1.30  {
    1.31 -	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    1.32 -
    1.33 -	glMatrixMode(GL_MODELVIEW);
    1.34 -	glLoadIdentity();
    1.35 -	glTranslatef(0, 0, -8);
    1.36 -
    1.37 -	glBegin(GL_QUADS);
    1.38 -	glColor3f(1, 0, 0);
    1.39 -	glVertex3f(-1, -1, 0);
    1.40 -	glColor3f(0, 1, 0);
    1.41 -	glVertex3f(1, -1, 0);
    1.42 -	glColor3f(0, 0, 1);
    1.43 -	glVertex3f(1, 1, 0);
    1.44 -	glColor3f(1, 1, 0);
    1.45 -	glVertex3f(-1, 1, 0);
    1.46 -	glEnd();
    1.47 +	redraw();
    1.48  
    1.49  	glutSwapBuffers();
    1.50  }
    1.51  
    1.52 -void reshape(int x, int y)
    1.53 -{
    1.54 -	glViewport(0, 0, x, y);
    1.55 -
    1.56 -	glMatrixMode(GL_PROJECTION);
    1.57 -	glLoadIdentity();
    1.58 -	gluPerspective(45.0, (float)x / (float)y, 1.0, 1000.0);
    1.59 -}
    1.60 -
    1.61  void keyb(unsigned char key, int x, int y)
    1.62  {
    1.63  	switch(key) {