X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=7a7875fe75271fb18a0715a4a6f10d08e3bed516;hp=e08b667a3729b7388968c9742305834b75158131;hb=336c0ba5151213006bd9537edef5d22368303519;hpb=edd4488bb9e7c4f04f2b8882387d88996e2da0da diff --git a/scene.c b/scene.c index e08b667..7a7875f 100644 --- a/scene.c +++ b/scene.c @@ -132,7 +132,7 @@ GLfloat angle2 = 30; /* in degrees */ GLfloat near = -10; GLfloat far = 10; -static float zoomFactor = 1.0; +static float zoomFactor = 0.0; /** * Prints out error message when file cannot be read @@ -489,10 +489,12 @@ 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(); + GLfloat x = 2.0f*(200 + 0.5)/w-1.0; + GLfloat y = 2.0f*(200 + 0.5)/h-1.0; + glTranslatef(-x,-y,0.0f); if (w <= h) glOrtho(zoomFactor*near, zoomFactor*far, zoomFactor*near*(GLfloat)h/(GLfloat)w, zoomFactor*far*(GLfloat)h/(GLfloat)w, near, far);