(no commit message)
authorAsh Tyndall <[email protected]>
Wed, 19 Oct 2011 12:28:26 +0000 (20:28 +0800)
committerAsh Tyndall <[email protected]>
Wed, 19 Oct 2011 12:28:26 +0000 (20:28 +0800)
scene.c

diff --git a/scene.c b/scene.c
index d6b3e8f..f3c4d2c 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -137,9 +137,10 @@ int floorSize = 100;
 \r
 /* Light 0 parameters */\r
 GLfloat diffuse0[] = {1.0, 1.0, 1.0, 1.0};\r
 \r
 /* Light 0 parameters */\r
 GLfloat diffuse0[] = {1.0, 1.0, 1.0, 1.0};\r
-GLfloat ambient0[] = {1.0, 1.0, 1.0, 1.0};\r
+GLfloat ambient0[] = {0.0, 0.0, 0.0, 1.0};\r
 GLfloat specular0[] = {1.0, 1.0, 1.0, 1.0};\r
 GLfloat specular0[] = {1.0, 1.0, 1.0, 1.0};\r
-GLfloat light0_pos[] ={ 1.0, 2.0, 3,0, 1.0};\r
+GLfloat emission0[] = {0.0, 0.0, 0.0, 1.0};\r
+GLfloat light0_pos[] ={ 1.0, 1.0, 0,0, 1.0};\r
 \r
 \r
 /**\r
 \r
 \r
 /**\r
@@ -637,12 +638,7 @@ void display() {
     0.0, 0.0,  0.0,  /* center is at (x,y,z) */\r
     0.0, 1.0,  0.0   /* up is in postivie Y direction */\r
     );\r
     0.0, 0.0,  0.0,  /* center is at (x,y,z) */\r
     0.0, 1.0,  0.0   /* up is in postivie Y direction */\r
     );\r
-    glEnable(GL_LIGHT0);\r
-  glLightfv(GL_LIGHT0, GL_POSITION, light0_pos);\r
-  glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0);\r
-  glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0);\r
-  glLightfv(GL_LIGHT0, GL_SPECULAR, specular0);\r
-  glEnable(GL_LIGHTING);\r
+\r
 \r
   // **NOTE: Currently this rotation function is all that moves the camera off\r
   //         the flat surface. Need to integrate function into gluLookAt\r
 \r
   // **NOTE: Currently this rotation function is all that moves the camera off\r
   //         the flat surface. Need to integrate function into gluLookAt\r
@@ -705,6 +701,11 @@ void init() {
   glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0);\r
   glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0);\r
   glLightfv(GL_LIGHT0, GL_SPECULAR, specular0);\r
   glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0);\r
   glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0);\r
   glLightfv(GL_LIGHT0, GL_SPECULAR, specular0);\r
+  glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );\r
+  glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, specular0);\r
+  glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, emission0);\r
+  glEnable(GL_COLOR_MATERIAL);\r
+\r
   glEnable(GL_LIGHTING);\r
 \r
   glMatrixMode(GL_MODELVIEW);\r
   glEnable(GL_LIGHTING);\r
 \r
   glMatrixMode(GL_MODELVIEW);\r

UCC git Repository :: git.ucc.asn.au