From aca15d4aefef5877fcf0ca9c2bd1a78eb5f6f0f1 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 8 Aug 2013 10:59:01 -0700 Subject: [PATCH] Disable specular highlights for ground and voxels. --- interface/src/Application.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6d272b757c..e5f28f914b 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2929,6 +2929,9 @@ void Application::displayOculus(Camera& whichCamera) { glPopMatrix(); } +const GLfloat WHITE_SPECULAR_COLOR[] = { 1.0f, 1.0f, 1.0f, 1.0f }; +const GLfloat NO_SPECULAR_COLOR[] = { 0.0f, 0.0f, 0.0f, 1.0f }; + void Application::setupWorldLight(Camera& whichCamera) { // Setup 3D lights (after the camera transform, so that they are positioned in world space) @@ -2943,10 +2946,9 @@ void Application::setupWorldLight(Camera& whichCamera) { glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color); GLfloat diffuse_color[] = { 0.8, 0.7, 0.7 }; glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color); - GLfloat specular_color[] = { 1.0, 1.0, 1.0, 1.0}; - glLightfv(GL_LIGHT0, GL_SPECULAR, specular_color); - glMaterialfv(GL_FRONT, GL_SPECULAR, specular_color); + glLightfv(GL_LIGHT0, GL_SPECULAR, WHITE_SPECULAR_COLOR); + glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR); glMateriali(GL_FRONT, GL_SHININESS, 96); } @@ -3024,6 +3026,9 @@ void Application::displaySide(Camera& whichCamera) { glutSolidSphere(sphereRadius, 15, 15); glPopMatrix(); + // disable specular lighting for ground and voxels + glMaterialfv(GL_FRONT, GL_SPECULAR, NO_SPECULAR_COLOR); + //draw a grid ground plane.... if (_renderGroundPlaneOn->isChecked()) { // draw grass plane with fog @@ -3052,6 +3057,9 @@ void Application::displaySide(Camera& whichCamera) { _voxels.render(_renderVoxelTextures->isChecked()); } + // restore default, white specular + glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR); + // indicate what we'll be adding/removing in mouse mode, if anything if (_mouseVoxel.s != 0) { glDisable(GL_LIGHTING);