uniforms_by_index[*j]->block = &info;
}
- vector<unsigned> indices2(indices.begin(), indices.end());
+ vector<unsigned> query_indices(indices.begin(), indices.end());
vector<int> values(indices.size());
- glGetActiveUniformsiv(id, indices.size(), &indices2[0], GL_UNIFORM_OFFSET, &values[0]);
+ glGetActiveUniformsiv(id, query_indices.size(), &query_indices[0], GL_UNIFORM_OFFSET, &values[0]);
for(unsigned j=0; j<indices.size(); ++j)
- uniforms_by_index[indices[j]]->location = values[j];
+ uniforms_by_index[indices[j]]->offset = values[j];
- indices2.clear();
+ query_indices.clear();
for(vector<int>::iterator j=indices.begin(); j!=indices.end(); ++j)
if(uniforms_by_index[*j]->array_size>1)
- indices2.push_back(*j);
- if(!indices2.empty())
+ query_indices.push_back(*j);
+ if(!query_indices.empty())
{
- glGetActiveUniformsiv(id, indices2.size(), &indices2[0], GL_UNIFORM_ARRAY_STRIDE, &values[0]);
- for(unsigned j=0; j<indices2.size(); ++j)
- uniforms_by_index[indices2[j]]->array_stride = values[j];
+ glGetActiveUniformsiv(id, query_indices.size(), &query_indices[0], GL_UNIFORM_ARRAY_STRIDE, &values[0]);
+ for(unsigned j=0; j<query_indices.size(); ++j)
+ uniforms_by_index[query_indices[j]]->array_stride = values[j];
}
- indices2.clear();
+ query_indices.clear();
for(vector<int>::iterator j=indices.begin(); j!=indices.end(); ++j)
{
DataType t = uniforms_by_index[*j]->type;
if(is_matrix(t))
- indices2.push_back(*j);
+ query_indices.push_back(*j);
}
- if(!indices2.empty())
+ if(!query_indices.empty())
{
- glGetActiveUniformsiv(id, indices2.size(), &indices2[0], GL_UNIFORM_MATRIX_STRIDE, &values[0]);
- for(unsigned j=0; j<indices2.size(); ++j)
- uniforms_by_index[indices2[j]]->matrix_stride = values[j];
+ glGetActiveUniformsiv(id, query_indices.size(), &query_indices[0], GL_UNIFORM_MATRIX_STRIDE, &values[0]);
+ for(unsigned j=0; j<query_indices.size(); ++j)
+ uniforms_by_index[query_indices[j]]->matrix_stride = values[j];
}
sort(info.uniforms.begin(), info.uniforms.end(), uniform_location_compare);
UniformInfo &info = uniforms[name];
info.name = name;
info.block = █
- info.location = i->offset;
+ info.offset = i->offset;
info.array_size = i->array_size;
info.array_stride = i->array_stride;
info.matrix_stride = i->matrix_stride;
return get_item(uniforms, name);
}
-int Program::get_uniform_location(const string &n) const
+int Program::get_uniform_location(const string &name) const
{
- if(n[n.size()-1]==']')
+ if(name[name.size()-1]==']')
throw invalid_argument("Program::get_uniform_location");
- UniformMap::const_iterator i = uniforms.find(n);
+ UniformMap::const_iterator i = uniforms.find(name);
if(i==uniforms.end())
return -1;
return get_item(attributes, name);
}
-int Program::get_attribute_location(const string &n) const
+int Program::get_attribute_location(const string &name) const
{
- if(n[n.size()-1]==']')
+ if(name[name.size()-1]==']')
throw invalid_argument("Program::get_attribute_location");
- AttributeMap::const_iterator i = attributes.find(n);
+ AttributeMap::const_iterator i = attributes.find(name);
return i!=attributes.end() ? i->second.location : -1;
}
Program::UniformInfo::UniformInfo():
block(0),
- location(0),
+ location(-1),
array_size(0),
array_stride(0),
matrix_stride(0),