From cfd9b0ca5b0169b95323a1cd1591c6ef36b97fac Mon Sep 17 00:00:00 2001 From: fgenesis Date: Wed, 15 May 2013 01:56:50 +0200 Subject: [PATCH] Fix bug in shader uniform assignment --- BBGE/Shader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BBGE/Shader.cpp b/BBGE/Shader.cpp index 1c8f4a8..d29707e 100644 --- a/BBGE/Shader.cpp +++ b/BBGE/Shader.cpp @@ -405,6 +405,9 @@ int Shader::_getUniformIndex(const char *name) { // binary search UniformVec::iterator it = stdx_fg::lower_bound(uniforms.begin(), uniforms.end(), name, _sortUniform); + // because lower_bound returns the first element that compares less, it might not be the correct one + if(it != uniforms.end() && strcmp(it->name, name)) + return -1; return int(it - uniforms.begin()); }