From 9a2ceeb56586fc687bf72d3a21c6972285ed9d0e Mon Sep 17 00:00:00 2001 From: Ash Tyndall Date: Sat, 22 Oct 2011 15:44:14 +0800 Subject: [PATCH 1/1] --- globals.c | 2 +- globals.h | 1 + helper.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/globals.c b/globals.c index df2e796..0137a2d 100644 --- a/globals.c +++ b/globals.c @@ -57,9 +57,9 @@ GLfloat defaultExponent = 1; GLfloat materialAmbient[] = {0.2, 0.2, 0.2, 1.0}; GLfloat materialDiffuse[] = {1.0, 0.8, 0.0, 1.0}; GLfloat materialSpecular[] = {1.0, 1.0, 1.0, 1.0}; +GLfloat materialShine = 100.0; /* Light parameters */ -GLfloat lightShine = 100.0; GLfloat lightGlobalModel[] = {0.2,0.2,0.2,1}; GLfloat lightGlobalEmission[] = {0.0, 0.3, 0.3, 1.0}; GLfloat lightBallSize = 0.2; diff --git a/globals.h b/globals.h index c75caf7..49097c6 100644 --- a/globals.h +++ b/globals.h @@ -51,6 +51,7 @@ extern GLfloat defaultExponent; extern GLfloat materialAmbient[]; extern GLfloat materialDiffuse[]; extern GLfloat materialSpecular[]; +extern GLfloat materialShine; /* Light parameters */ extern GLfloat lightShine; diff --git a/helper.c b/helper.c index cb4278d..786297f 100644 --- a/helper.c +++ b/helper.c @@ -319,6 +319,11 @@ int addSceneObject(int id) { } void initializeLights() { + glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, materialAmbient ); + glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, materialDiffuse ); + glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, materialSpecular ); + glMaterialf ( GL_FRONT_AND_BACK, GL_SHININESS, materialShine ); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lightGlobalModel); glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); -- 2.20.1