summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-11-29 22:58:41 +0100
committerPeter Wu <lekensteyn@gmail.com>2013-11-29 22:58:41 +0100
commitf5aeb29933dba162e46298bea7e8b4ed9c4886ca (patch)
tree7e6174f35c6376b0214ae2c843af73e17519a934
parent6cc6461c316ff75aa71c577891fb484c046bf0c5 (diff)
download2iv60-robots-f5aeb29933dba162e46298bea7e8b4ed9c4886ca.tar.gz
Fix lighting bug, cleanup
Pitfall 1 from http://www.opengl.org/archives/resources/features/KilgardTechniques/oglpitfall/
-rw-r--r--src/RobotRace.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/RobotRace.java b/src/RobotRace.java
index 9dfda81..308d5de 100644
--- a/src/RobotRace.java
+++ b/src/RobotRace.java
@@ -167,24 +167,22 @@ public class RobotRace extends Base {
private void initLighting() {
// greyish color
float[] ambientRGBA = {0.2f, 0.2f, 0.2f, 1.0f};
- // yellowish - "sunglow" RGB (255, 204, 51)
- //float[] diffuseRGBA = {1.0f, 0.8f, 0.2f, 1.0f};
- // red!
+ // red! the color of the blood!
float[] diffuseRGBA = {1.0f, 0.0f, 0.0f, 1.0f};
// set the light-source colors
gl.glLightfv(GL_LIGHT0, GL_AMBIENT, ambientRGBA, 0);
gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseRGBA, 0);
- // global ambient light
- //gl.glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientRGBA, 0);
-
// turn the light on (note: display func must set or unset LIGHTING)
gl.glEnable(GL_LIGHT0);
//gl.glEnable(GL_LIGHTING);
// blend the light with the material colors
gl.glEnable(GL_COLOR_MATERIAL);
+
+ // necessary because normals are improperly scaled
+ gl.glEnable(GL_NORMALIZE);
}
/**