set up modelview matrix, bigger window

This commit is contained in:
Josh Holtrop 2011-04-28 17:52:07 -04:00
parent 13cb39e79e
commit ba2c1d9c60

View File

@ -3,14 +3,22 @@
#include <GL/gl.h>
#include <GL/glu.h>
#define WIDTH 500
#define HEIGHT 500
#define WIDTH 800
#define HEIGHT 600
void init(void)
GLuint vs, fs;
void init(int width, int height)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
glViewport(0, 0, WIDTH, HEIGHT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho((float)-width/(float)height, (float)width/(float)height,
-1, 1, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void display(void)
@ -39,7 +47,7 @@ int main(int argc, char *argv[])
}
SDL_WM_SetCaption(argv[0], argv[0]);
init();
init(WIDTH, HEIGHT);
display();
SDL_Event event;
while (SDL_WaitEvent(&event))