From 1e95989edd005627e67b3ef02810c584e6a98895 Mon Sep 17 00:00:00 2001 From: Ash Tyndall Date: Sun, 9 Oct 2011 14:39:52 +0800 Subject: [PATCH 1/1] --- scene.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scene.c b/scene.c index 513ba51..49782af 100644 --- a/scene.c +++ b/scene.c @@ -464,7 +464,15 @@ void makeMenu() { * @param h New height */ void windowReshape(int w, int h) { + glViewport(0, 0, w, h); // Reset The Current Viewport + glMatrixMode(GL_PROJECTION); // Select The Projection Matrix + glLoadIdentity(); // Reset The Projection Matrix + // Calculate The Aspect Ratio Of The Window + gluPerspective(45.0f,(GLfloat)w/(GLfloat)h,0.1f,100.0f); + + glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix + glLoadIdentity(); // Reset The Modelview Matrix } /** @@ -488,8 +496,7 @@ void display() { glTranslatef(-1.5f, 0.0f, -6.0f); glBegin(GL_QUADS); - - glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red + glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red glVertex3f(-1.0f, 1.0f, 0.0f); // Top left glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right -- 2.20.1