From: Ash Tyndall Date: Tue, 18 Oct 2011 12:40:23 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=6fbc798d09b7ceccd066d2898677bda36e6d592b;p=atyndall%2Fcits2231.git --- diff --git a/scene.c b/scene.c index 0841edd..1bafde5 100644 --- a/scene.c +++ b/scene.c @@ -674,11 +674,17 @@ void init() { far /* Z far */ ); - glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); - 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); + +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 light0_pos[] ={ 1.0, 2.0, 3,0, 1.0}; + +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); glMatrixMode(GL_MODELVIEW);