mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 04:03:59 +02:00
Fix for specular issue on Nvidia, try passing along material colors.
This commit is contained in:
parent
9caa4d3a08
commit
70c8c146bc
5 changed files with 16 additions and 10 deletions
|
@ -18,8 +18,8 @@ void main(void) {
|
|||
// transform and store the normal for interpolation
|
||||
normal = normalize(gl_ModelViewMatrix * vec4(gl_Normal, 0.0));
|
||||
|
||||
// pass along the vertex color
|
||||
gl_FrontColor = vec4(gl_Color.rgb, 0.0);
|
||||
// pass along the diffuse color
|
||||
gl_FrontColor = gl_FrontMaterial.diffuse;
|
||||
|
||||
// and the texture coordinates
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
|
|
@ -25,8 +25,8 @@ void main(void) {
|
|||
interpolatedNormal = gl_ModelViewMatrix * vec4(gl_Normal, 0.0);
|
||||
interpolatedTangent = gl_ModelViewMatrix * vec4(tangent, 0.0);
|
||||
|
||||
// pass along the vertex color
|
||||
gl_FrontColor = vec4(gl_Color.rgb, 0.0);
|
||||
// pass along the diffuse color
|
||||
gl_FrontColor = gl_FrontMaterial.diffuse;
|
||||
|
||||
// and the texture coordinates
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
|
|
@ -34,8 +34,8 @@ void main(void) {
|
|||
|
||||
normal = normalize(gl_ModelViewMatrix * normal);
|
||||
|
||||
// pass along the vertex color
|
||||
gl_FrontColor = vec4(1.0, 1.0, 1.0, 0.0);
|
||||
// pass along the diffuse color
|
||||
gl_FrontColor = gl_FrontMaterial.diffuse;
|
||||
|
||||
// and the texture coordinates
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
|
|
@ -42,8 +42,8 @@ void main(void) {
|
|||
interpolatedNormal = gl_ModelViewMatrix * interpolatedNormal;
|
||||
interpolatedTangent = gl_ModelViewMatrix * interpolatedTangent;
|
||||
|
||||
// pass along the vertex color
|
||||
gl_FrontColor = vec4(1.0, 1.0, 1.0, 0.0);
|
||||
// pass along the diffuse color
|
||||
gl_FrontColor = gl_FrontMaterial.diffuse;
|
||||
|
||||
// and the texture coordinates
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
|
|
@ -28,9 +28,15 @@ void DeferredLightingEffect::init() {
|
|||
|
||||
void DeferredLightingEffect::prepare() {
|
||||
// clear the normal and specular buffers
|
||||
Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(false, true, true);
|
||||
Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(false, true, false);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false);
|
||||
Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(false, false, true);
|
||||
// clearing to zero alpha for specular causes problems on my Nvidia card; clear to lowest non-zero value instead
|
||||
const float MAX_SPECULAR_EXPONENT = 128.0f;
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f / MAX_SPECULAR_EXPONENT);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false, false);
|
||||
}
|
||||
|
||||
void DeferredLightingEffect::render() {
|
||||
|
|
Loading…
Reference in a new issue