From: Mikko Rasa Date: Fri, 24 Aug 2012 21:47:01 +0000 (+0300) Subject: Uniform handling fixes X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=ac11296dca7c7a594ff1b20bead87e1e161b4bef;p=libs%2Fgl.git Uniform handling fixes Initialize strides to zero, and return a location of -1 for uniforms in blocks. --- diff --git a/source/program.cpp b/source/program.cpp index 8892bcf1..ffcc4a6c 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -254,6 +254,8 @@ void Program::link() info.block = 0; info.name = name; info.size = size; + info.array_stride = 0; + info.matrix_stride = 0; info.type = type; uniforms_by_index[i] = &info; } @@ -373,14 +375,14 @@ int Program::get_uniform_location(const string &n) const add an offset. */ unsigned offset = lexical_cast(n.substr(open_bracket+1, n.size()-2-open_bracket)); i = uniforms.find(n.substr(0, open_bracket)+"[0]"); - if(i!=uniforms.end() && offsetsecond.size) + if(i!=uniforms.end() && !i->second.block && offsetsecond.size) return i->second.location+offset; } } return -1; } - return i->second.location; + return i->second.block ? -1 : i->second.location; } void Program::bind() const