From 3949c210f605285b97af2bc3fe105181cc9cfcfc Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 23 Sep 2013 14:02:39 +0200 Subject: [PATCH] OpenGL should be fed a clamped color value. --HG-- branch : gsoc2013-dfighter --- .../driver/OpenGL3/driver_opengl_material.cpp | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_material.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl_material.cpp index ae407fee7..3b44c5d23 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_material.cpp @@ -650,17 +650,32 @@ bool CDriverGL3::setupDynMatPass( uint pass ) break; case SDynMaterialProp::Color: + { + float v[ 4 ]; + prop->value.getVector4( v ); + + for( int j = 0; j < 4; j++ ) + v[ j ] = v[ j ] / 255.0f; + + setUniform4f( loc, v[ 0 ], v[ 1 ], v[ 2 ], v[ 3 ] ); + } + break; + case SDynMaterialProp::Vector4: - float v[ 4 ]; - prop->value.getVector4( v ); - setUniform4f( loc, v[ 0 ], v[ 1 ], v[ 2 ], v[ 3 ] ); + { + float v[ 4 ]; + prop->value.getVector4( v ); + setUniform4f( loc, v[ 0 ], v[ 1 ], v[ 2 ], v[ 3 ] ); + } break; case SDynMaterialProp::Matrix4: - float m[ 16 ]; - prop->value.getMatrix4( m ); - setUniformMatrix4fv( loc, 1, false, m ); - break; + { + float m[ 16 ]; + prop->value.getMatrix4( m ); + setUniformMatrix4fv( loc, 1, false, m ); + break; + } case SDynMaterialProp::Texture: break;