From: Ash Tyndall Date: Sun, 9 Oct 2011 06:47:27 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=7e5c9a1278e56a10870f26ca4f31359b4697e9a3;p=atyndall%2Fcits2231.git --- diff --git a/scene.c b/scene.c index f899dd8..457e23d 100644 --- a/scene.c +++ b/scene.c @@ -464,8 +464,18 @@ void makeMenu() { * @param h New height */ void windowReshape(int w, int h) { - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); /* switch matrix mode */ + 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 + + /*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);