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))