From 4bcc8e39f5d73c7b210a48d3ca4dcd53ed8fb37e Mon Sep 17 00:00:00 2001 From: Ash Tyndall Date: Fri, 21 Oct 2011 08:15:03 +0800 Subject: [PATCH] --- scene.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scene.c b/scene.c index 0c5329b..fe67e13 100644 --- a/scene.c +++ b/scene.c @@ -184,7 +184,15 @@ void makeMenu() { */ void windowReshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); - // **NOTE: windowReshape needs to be re-written using glFrustrum and perspective projection calculations + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if (w <= h) + glFrustum(-1.0, 1.0, -1.0*(GLfloat) h / (GLfloat) w, + 1.0*(GLfloat) h / (GLfloat) w, 2.0, 10.0); + else + glFrustum(-1.0*(GLfloat) w / (GLfloat) h, + 1.0*(GLfloat) w / (GLfloat) h, -1.0, 1.0, 2.0, 10.0); + glMatrixMode(GL_MODELVIEW); } /** -- 2.20.1