diff --git a/src/AbstractShaderProgram.cpp b/src/AbstractShaderProgram.cpp index 8dc1b631a..46eb356e3 100644 --- a/src/AbstractShaderProgram.cpp +++ b/src/AbstractShaderProgram.cpp @@ -50,35 +50,19 @@ bool AbstractShaderProgram::attachShader(Shader* shader) { return true; } -bool AbstractShaderProgram::bindAttribute(GLuint location, const string& name) { +void AbstractShaderProgram::bindAttribute(GLuint location, const string& name) { if(state != Initialized) { Error() << "AbstractShaderProgram: attribute cannot be bound after linking."; assert(0); - return false; } - /* Check whether given id already exists */ - if(attributes.find(location) != attributes.end()) return false; - - /* Check whether given name already exists */ - for(map::const_iterator it = attributes.begin(); it != attributes.end(); ++it) - if(it->second == name) return false; - - attributes.insert(pair(location, name)); - return true; + glBindAttribLocation(program, location, name.c_str()); } void AbstractShaderProgram::link() { /* Already compiled or failed, exit */ if(state != Initialized) return; - /* Set state to failed if anything goes wrong */ - state = Failed; - - /* Bind attributes to specified locations */ - for(map::const_iterator it = attributes.begin(); it != attributes.end(); ++it) - glBindAttribLocation(program, it->first, it->second.c_str()); - /* Link shader program */ glLinkProgram(program); diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 9841a3cb9..167d059a3 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -126,15 +126,13 @@ class MAGNUM_EXPORT AbstractShaderProgram { * @brief Bind attribute to given location * @param location Location * @param name Attribute name - * @return False if the location or name is already bound, true - * otherwise. * - * Binds attribute to the location which can be used later when binding + * Binds attribute to location which is be used later for binding * vertex buffers. * @note This function should be called between loadShader() calls * and link(). */ - bool bindAttribute(GLuint location, const std::string& name); + void bindAttribute(GLuint location, const std::string& name); /** * @brief Link the shader @@ -207,7 +205,6 @@ class MAGNUM_EXPORT AbstractShaderProgram { GLuint program; State state; - std::map attributes; }; }