From 32a589d633b12c8cf9f1b7414a1f29751ae27e66 Mon Sep 17 00:00:00 2001 From: josh Date: Tue, 5 Jun 2007 01:39:57 +0000 Subject: [PATCH] updated git-svn-id: svn://anubis/sdl-opengl-bare@2 486f0dac-8830-0410-96c3-f050bc5976a0 --- sdl_tmplt.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/sdl_tmplt.c b/sdl_tmplt.c index 347ab05..00273ed 100644 --- a/sdl_tmplt.c +++ b/sdl_tmplt.c @@ -11,6 +11,13 @@ void init(void) glClearColor (0.0, 0.0, 0.0, 0.0); glEnable(GL_DEPTH_TEST); glShadeModel(GL_FLAT); + glViewport(0, 0, WIDTH, HEIGHT); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, (GLfloat)WIDTH/(GLfloat)WIDTH, 1.0, 30.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -3.6); } void display(void) @@ -22,20 +29,9 @@ void display(void) glVertex3f(0.0, 1.0, 0.0); glVertex3f(0.0, -1.0, 0.0); glEnd(); + SDL_GL_SwapBuffers(); } -void reshape(GLsizei w, GLsizei h) -{ - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -3.6); -} - - int main(int argc, char *argv[]) { if (SDL_Init(SDL_INIT_VIDEO)) @@ -57,9 +53,7 @@ int main(int argc, char *argv[]) SDL_WM_SetCaption(argv[0], argv[0]); init(); - reshape(WIDTH, HEIGHT); display(); - SDL_GL_SwapBuffers(); SDL_Event event; while (SDL_WaitEvent(&event)) {