X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=c6ef084cdaf2b73bbc9b41a99a6d22b777cdae81;hp=1bafde50ccb55a323d33fd9e310230f951b521d2;hb=86cadef4c5a94d3eeecd3f18b70b6a2e1cae555e;hpb=6fbc798d09b7ceccd066d2898677bda36e6d592b diff --git a/scene.c b/scene.c index 1bafde5..c6ef084 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 @@ -491,11 +493,11 @@ void windowReshape(int w, int 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(); } @@ -675,9 +677,9 @@ void init() { ); -GLfloat diffuse0[] = {1.0, 0.0, 0.0, 1.0}; -GLfloat ambient0[] = {1.0, 0.0, 0.0, 1.0}; -GLfloat specular0[] = {1.0, 0.0, 0.0, 1.0}; +GLfloat diffuse0[] = {1.0, 1.0, 1.0, 1.0}; +GLfloat ambient0[] = {1.0, 1.0, 1.0, 1.0}; +GLfloat specular0[] = {1.0, 1.0, 1.0, 1.0}; GLfloat light0_pos[] ={ 1.0, 2.0, 3,0, 1.0}; glEnable(GL_LIGHT0);