X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=0841edd9dbc2ae1b0143199c8180500d16bc20a4;hp=a5fc5b61d02ba78d50530f3af5472518c50092bc;hb=741e1b28cd622388927419ba40da12a6e066fae3;hpb=e48ca30778e541867597d6b491ed86a4a43081b9 diff --git a/scene.c b/scene.c index a5fc5b6..0841edd 100644 --- a/scene.c +++ b/scene.c @@ -129,6 +129,9 @@ static float lightAngle = 0.0, lightHeight = 5; GLfloat angle = -150; /* in degrees */ GLfloat angle2 = 30; /* in degrees */ +GLfloat near = -10; +GLfloat far = 10; + /** * Prints out error message when file cannot be read * @param fileName Name of file that could not be read @@ -484,9 +487,6 @@ void makeMenu() { * @param h New height */ void windowReshape(int w, int h) { - GLdouble near = -10.0; - GLdouble far = 10.0; - glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -670,12 +670,12 @@ void init() { gluPerspective( 60.0, /* field of view in degree */ 1.0, /* aspect ratio */ - -1000.0, /* Z near */ - 1000.0 /* Z far */ + near, /* Z near */ + far /* Z far */ ); glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); - glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor); + glLightfv(GL_LIGHT0, GL_AMBIENT|GL_SPECULAR|GL_DIFFUSE, lightColor); glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05); glEnable(GL_LIGHT0);