From: Ash Tyndall Date: Wed, 19 Oct 2011 12:28:26 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=55097a45c4add91cd839f9d86d2255f2de5a9ab0;p=atyndall%2Fcits2231.git --- diff --git a/scene.c b/scene.c index d6b3e8f..f3c4d2c 100644 --- a/scene.c +++ b/scene.c @@ -137,9 +137,10 @@ int floorSize = 100; /* Light 0 parameters */ GLfloat diffuse0[] = {1.0, 1.0, 1.0, 1.0}; -GLfloat ambient0[] = {1.0, 1.0, 1.0, 1.0}; +GLfloat ambient0[] = {0.0, 0.0, 0.0, 1.0}; GLfloat specular0[] = {1.0, 1.0, 1.0, 1.0}; -GLfloat light0_pos[] ={ 1.0, 2.0, 3,0, 1.0}; +GLfloat emission0[] = {0.0, 0.0, 0.0, 1.0}; +GLfloat light0_pos[] ={ 1.0, 1.0, 0,0, 1.0}; /** @@ -637,12 +638,7 @@ void display() { 0.0, 0.0, 0.0, /* center is at (x,y,z) */ 0.0, 1.0, 0.0 /* up is in postivie Y direction */ ); - glEnable(GL_LIGHT0); - 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); - glEnable(GL_LIGHTING); + // **NOTE: Currently this rotation function is all that moves the camera off // the flat surface. Need to integrate function into gluLookAt @@ -705,6 +701,11 @@ void init() { glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0); glLightfv(GL_LIGHT0, GL_SPECULAR, specular0); + glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); + glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, specular0); + glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, emission0); + glEnable(GL_COLOR_MATERIAL); + glEnable(GL_LIGHTING); glMatrixMode(GL_MODELVIEW);