From: Ash Tyndall Date: Sun, 9 Oct 2011 06:52:34 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=bc9211f84f6c3e269c4bf55c5f2363490b02b7ce;p=atyndall%2Fcits2231.git --- diff --git a/scene.c b/scene.c index b85ed9f..2f3d206 100644 --- a/scene.c +++ b/scene.c @@ -464,7 +464,7 @@ void makeMenu() { * @param h New height */ void windowReshape(int w, int h) { - glViewport(0, 0, w, h); // Reset The Current Viewport + /* glViewport(0, 0, w, h); // Reset The Current Viewport glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix @@ -472,16 +472,16 @@ void windowReshape(int w, int h) { gluPerspective(45.0f,45.0f,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glLoadIdentity(); // Reset The Modelview Matrix - - /*glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); /* switch matrix mode - glLoadIdentity(); - if (w <= h) - gluOrtho2D(-2.0, 2.0, -2.0 * (GLfloat) h / (GLfloat) w, 2.0 * (GLfloat) h / (GLfloat) w); - else - gluOrtho2D(-2.0 * (GLfloat) w / (GLfloat) h, 2.0 * (GLfloat) w / (GLfloat) h, -2.0, 2.0); - glMatrixMode(GL_MODELVIEW); /* return to modelview mode */ + glLoadIdentity(); // Reset The Modelview Matrix*/ + + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); /* switch matrix mode*/ + glLoadIdentity(); + if (w <= h) + gluOrtho2D(-10.0, 10.0, -10.0 * (GLfloat) h / (GLfloat) w, 10.0 * (GLfloat) h / (GLfloat) w); + else + gluOrtho2D(-10.0 * (GLfloat) w / (GLfloat) h, 10.0 * (GLfloat) w / (GLfloat) h, -10.0, 10.0); + glMatrixMode(GL_MODELVIEW); /* return to modelview mode */ } /**