From: Ash Tyndall Date: Thu, 20 Oct 2011 12:55:57 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=94077e45199058ba8c53a1029d782fb280d2f237;p=atyndall%2Fcits2231.git --- diff --git a/scene.c b/scene.c index feead2f..2cce6e4 100644 --- a/scene.c +++ b/scene.c @@ -363,23 +363,26 @@ void init() { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); + // **NOTE: Needs tidy + glLightfv(GL_LIGHT0, GL_POSITION, light0_pos); glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0); glLightfv(GL_LIGHT0, GL_SPECULAR, specular0); + glLighti(GL_LIGHT0, GL_SPOT_CUTOFF, 60); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, glightmodel); -GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0}; -GLfloat diffuse[] = {1.0, 0.8, 0.0, 1.0}; -GLfloat specular[] = {1.0, 1.0, 1.0, 1.0}; -GLfloat shine = 100.0; -glMaterialfv(GL_FRONT, GL_AMBIENT, ambient); -glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse); -glMaterialfv(GL_FRONT, GL_SPECULAR, specular); -glMaterialf(GL_FRONT, GL_SHININESS, shine); + GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0}; + GLfloat diffuse[] = {1.0, 0.8, 0.0, 1.0}; + GLfloat specular[] = {1.0, 1.0, 1.0, 1.0}; + GLfloat shine = 100.0; + glMaterialfv(GL_FRONT, GL_AMBIENT, ambient); + glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, specular); + glMaterialf(GL_FRONT, GL_SHININESS, shine); -GLfloat emission[] = {0.0, 0.3, 0.3, 1.0}; -glMaterialfv(GL_FRONT, GL_EMISSION, emission); + GLfloat emission[] = {0.0, 0.3, 0.3, 1.0}; + glMaterialfv(GL_FRONT, GL_EMISSION, emission); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); @@ -432,15 +435,15 @@ int main(int argc, char **argv) { gluPerspective( 40.0, /* field of view in degree */ 1.0, /* aspect ratio */ - 1.0, /* Z near */ - 1000000.0 /* Z far */ + 1.0, /* Z near */ + 100.0 /* Z far */ ); glMatrixMode(GL_MODELVIEW); gluLookAt( - 0.0, 35.0, -20.0, /* eye is at (0,8,60) */ + 0.0, 35.0, -20.0, /* eye is at (0,8,60) */ 0.0, 10.0, 0.0, /* center is at (0,8,0) */ - 0.0, 1.0, 0.0 /* up is in postivie Y direction */ + 0.0, 1.0, 0.0 /* up is in postivie Y direction */ ); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);