From: Ash Tyndall Date: Fri, 21 Oct 2011 00:15:03 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=commitdiff_plain;h=4bcc8e39f5d73c7b210a48d3ca4dcd53ed8fb37e --- 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); } /**