From ba2c1d9c606c705137a27ec11f24a2f339a840b1 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 28 Apr 2011 17:52:07 -0400 Subject: [PATCH] set up modelview matrix, bigger window --- template/test.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/template/test.cc b/template/test.cc index e09b8f8..09fc399 100644 --- a/template/test.cc +++ b/template/test.cc @@ -3,14 +3,22 @@ #include #include -#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))