X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=fe67e1395e4e8f3a710e1fad549f0c1af57e8ce5;hp=0c5329b2d01d38f5f52c0f66e6eeb991bc5002fb;hb=4bcc8e39f5d73c7b210a48d3ca4dcd53ed8fb37e;hpb=84eea711e741871dfb6cc595a0989e1369998d7f 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); } /**