History

Fix for specular issue on Nvidia, try passing along material colors.

Andrzej Kapolka committed 12 years ago

Commit 70c8c141 parent 9caa4d35 files · +16 −10Browse files

Showing the changes to interface/src/renderer/DeferredLightingEffect.cpp (1 of 5 files). Show all

Unified · Split

interface/src/renderer/DeferredLightingEffect.cpp+8−2
@@ -28,9 +28,15 @@ void DeferredLightingEffect::init() { · 27 unmodified lines
2828
2929 void DeferredLightingEffect::prepare() {
3030 // clear the normal and specular buffers
31− Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(false, true, true);
31+ Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(false, true, false);
3232 glClear(GL_COLOR_BUFFER_BIT);
33− Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false);
33+ Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(false, false, true);
34+ // clearing to zero alpha for specular causes problems on my Nvidia card; clear to lowest non-zero value instead
35+ const float MAX_SPECULAR_EXPONENT = 128.0f;
36+ glClearColor(0.0f, 0.0f, 0.0f, 1.0f / MAX_SPECULAR_EXPONENT);
37+ glClear(GL_COLOR_BUFFER_BIT);
38+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
39+ Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false, false);
3440 }
3541
3642 void DeferredLightingEffect::render() {