From ecb5504bd106a4fb691c6eea7d96f8a156b8bb14 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 12 Nov 2018 22:51:44 -0500 Subject: [PATCH] Switches `enable_vertex_attribute_with_pointer` to silent failure (versus glGetError). --- Outputs/OpenGL/Primitives/Shader.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Outputs/OpenGL/Primitives/Shader.cpp b/Outputs/OpenGL/Primitives/Shader.cpp index 879ca2167..23a10351d 100644 --- a/Outputs/OpenGL/Primitives/Shader.cpp +++ b/Outputs/OpenGL/Primitives/Shader.cpp @@ -104,9 +104,11 @@ GLint Shader::get_uniform_location(const std::string &name) { void Shader::enable_vertex_attribute_with_pointer(const std::string &name, GLint size, GLenum type, GLboolean normalised, GLsizei stride, const GLvoid *pointer, GLuint divisor) { GLint location = get_attrib_location(name); - glEnableVertexAttribArray((GLuint)location); - glVertexAttribPointer((GLuint)location, size, type, normalised, stride, pointer); - glVertexAttribDivisor((GLuint)location, divisor); + if(location >= 0) { + glEnableVertexAttribArray((GLuint)location); + glVertexAttribPointer((GLuint)location, size, type, normalised, stride, pointer); + glVertexAttribDivisor((GLuint)location, divisor); + } } // The various set_uniforms...