From cb50120e275596b508ec114343459b8de46c3327 Mon Sep 17 00:00:00 2001 From: Ash Tyndall Date: Sun, 9 Oct 2011 15:16:14 +0800 Subject: [PATCH] --- scene.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/scene.c b/scene.c index b806a5f..a342724 100644 --- a/scene.c +++ b/scene.c @@ -464,20 +464,11 @@ void makeMenu() { * @param height New height */ void windowReshape(int width, int height) { - glViewport(0, 0, (GLsizei)width, (GLsizei)height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - gluPerspective(60, 1, 0.1, 1000.0); - - /*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 */ + glViewport(0, 0, (GLsizei)width, (GLsizei)height); // Set our viewport to the size of our window + glMatrixMode(GL_PROJECTION); // Switch to the projection matrix so that we can manipulate how our scene is viewed + glLoadIdentity(); // Reset the projection matrix to the identity matrix so that we don't get any artifacts (cleaning up) + gluPerspective(60, (GLfloat)width / (GLfloat)height, 0.1, 1000.0); // Set the Field of view angle (in degrees), the aspect ratio of our window, and the new and far planes + glMatrixMode(GL_MODELVIEW); // Switch back to the model view matrix, so that we can start drawing shapes correctly } /** -- 2.20.1