From 122857e5b5185ce337f7585377bc76749f00a80c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 30 Jan 2019 18:20:42 -0500 Subject: [PATCH] Improves automatic index generation, to allow for matrices implicitly taking up to four slots. --- Outputs/OpenGL/Primitives/Shader.cpp | 2 +- Outputs/OpenGL/Primitives/Shader.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Outputs/OpenGL/Primitives/Shader.cpp b/Outputs/OpenGL/Primitives/Shader.cpp index 82369fc06..3aa6381ab 100644 --- a/Outputs/OpenGL/Primitives/Shader.cpp +++ b/Outputs/OpenGL/Primitives/Shader.cpp @@ -53,7 +53,7 @@ Shader::Shader(const std::string &vertex_shader, const std::string &fragment_sha GLuint index = 0; for(const auto &name: binding_names) { bindings.emplace_back(name, index); - ++index; + index += 4; } init(vertex_shader, fragment_shader, bindings); } diff --git a/Outputs/OpenGL/Primitives/Shader.hpp b/Outputs/OpenGL/Primitives/Shader.hpp index 995bbb704..4fceb82f9 100644 --- a/Outputs/OpenGL/Primitives/Shader.hpp +++ b/Outputs/OpenGL/Primitives/Shader.hpp @@ -50,7 +50,7 @@ public: Attempts to compile a shader, throwing @c VertexShaderCompilationError, @c FragmentShaderCompilationError or @c ProgramLinkageError upon failure. @param vertex_shader The vertex shader source code. @param fragment_shader The fragment shader source code. - @param binding_names A list of attributes to generate bindings for; these will be given indices 0...n-1. + @param binding_names A list of attributes to generate bindings for; these will be given indices 0, 4, 8 ... 4(n-1). */ Shader(const std::string &vertex_shader, const std::string &fragment_shader, const std::vector &binding_names); ~Shader();