From: Ash Tyndall Date: Sun, 9 Oct 2011 06:39:52 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=1e95989edd005627e67b3ef02810c584e6a98895;p=atyndall%2Fcits2231.git --- 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