X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=496203791a666a4b516989012844e795ce976b1c;hb=1bacda10b9d25b0403fc1a4ee0514372e2932bfa;hp=e3004ee8d6450eb1e2966d9e8172a4911dcbbf9a;hpb=4bce415af0e0be9392c2725a8fc4f9a3cc0fad11;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index e3004ee..4962037 100644 --- a/scene.c +++ b/scene.c @@ -132,6 +132,8 @@ GLfloat angle2 = 30; /* in degrees */ GLfloat near = -10; GLfloat far = 10; +static float zoomFactor = 1.0; + /** * Prints out error message when file cannot be read * @param fileName Name of file that could not be read @@ -487,15 +489,16 @@ void makeMenu() { * @param h New height */ void windowReshape(int w, int h) { + zoomFactor = zoomFactor + 1; glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); if (w <= h) - glOrtho(near, far, near*(GLfloat)h/(GLfloat)w, - far*(GLfloat)h/(GLfloat)w, near, far); + glOrtho(zoomFactor*near, zoomFactor*far, zoomFactor*near*(GLfloat)h/(GLfloat)w, + zoomFactor*far*(GLfloat)h/(GLfloat)w, near, far); else - glOrtho(near*(GLfloat)w/(GLfloat)h, - far*(GLfloat)w/(GLfloat)h, near, far, near, far); + glOrtho(zoomFactor*near*(GLfloat)w/(GLfloat)h, + zoomFactor*far*(GLfloat)w/(GLfloat)h, zoomFactor*near, zoomFactor*far, near, far); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }