From: Ash Tyndall Date: Thu, 20 Oct 2011 12:46:05 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=commitdiff_plain;h=6f99c6996f2ee53c81344a37eaf7bdcf4e6665cd --- diff --git a/globals.c b/globals.c index 2ece38c..4c829c5 100644 --- a/globals.c +++ b/globals.c @@ -79,9 +79,9 @@ GLfloat camx = 0.0, camy = 0.0, camz = 0.0, rot = 0.0; GLfloat lineLength = 100; /* Light 0 parameters */ -GLfloat diffuse0[] = {1.0, 1.0, 1.0, 0.5}; -GLfloat ambient0[] = {1.0, 1.0, 1.0, 0.5}; -GLfloat specular0[] = {1.0, 1.0, 1.0, 0.5}; +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 emission0[] = {1.0, 1.0, 1.0, 0.5}; GLfloat light0_pos[] ={1.0, 1.0, 0,0, 0.5}; GLfloat glightmodel[] = {0.2,0.2,0.2,1}; \ No newline at end of file diff --git a/scene.c b/scene.c index a8f37dd..feead2f 100644 --- a/scene.c +++ b/scene.c @@ -368,12 +368,25 @@ void init() { glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0); glLightfv(GL_LIGHT0, GL_SPECULAR, specular0); 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 emission[] = {0.0, 0.3, 0.3, 1.0}; +glMaterialfv(GL_FRONT, GL_EMISSION, emission); + glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); - glEnable(GL_COLOR_MATERIAL); - 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); + //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);