Browse Source

Added AbstractShaderProgram::attachShaders().

Convenience overload to attachShader(), allowing the user to specify
more than one shader at once. Just a complement to initializer-list
versions of compile() and link(), but without any performance
difference.
pull/68/head
Vladimír Vondruš 12 years ago
parent
commit
bc81eb92d8
  1. 4
      src/Magnum/AbstractShaderProgram.cpp
  2. 9
      src/Magnum/AbstractShaderProgram.h

4
src/Magnum/AbstractShaderProgram.cpp

@ -262,6 +262,10 @@ void AbstractShaderProgram::attachShader(Shader& shader) {
glAttachShader(_id, shader.id());
}
void AbstractShaderProgram::attachShaders(std::initializer_list<std::reference_wrapper<Shader>> shaders) {
for(Shader& s: shaders) attachShader(s);
}
void AbstractShaderProgram::bindAttributeLocation(UnsignedInt location, const std::string& name) {
glBindAttribLocation(_id, location, name.data());
}

9
src/Magnum/AbstractShaderProgram.h

@ -614,6 +614,15 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
*/
void attachShader(Shader& shader);
/**
* @brief Attach shaders
*
* Convenience overload to the above, allowing the user to specify more
* than one shader at once. Other than that there is no other
* (performance) difference when using this function.
*/
void attachShaders(std::initializer_list<std::reference_wrapper<Shader>> shaders);
/**
* @brief Bind attribute to given location
* @param location Location

Loading…
Cancel
Save