From b7d4d39417817377be78adca023da5319304cc37 Mon Sep 17 00:00:00 2001 From: Martin Wickham Date: Tue, 28 Oct 2014 12:42:35 -0500 Subject: [PATCH] Fix error when shader can't link Calling glValidateProgram clears glGetProgramInfoLog, so must check for link error before validating. --- Cura/gui/util/openglHelpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cura/gui/util/openglHelpers.py b/Cura/gui/util/openglHelpers.py index dd4aa595..0c1e9cb6 100644 --- a/Cura/gui/util/openglHelpers.py +++ b/Cura/gui/util/openglHelpers.py @@ -48,12 +48,12 @@ class GLShader(GLReferenceCounter): glAttachShader(self._program, vertexShader) glAttachShader(self._program, fragmentShader) glLinkProgram(self._program) + if glGetProgramiv(self._program, GL_LINK_STATUS) == GL_FALSE: + raise RuntimeError("Link failure: %s" % (glGetProgramInfoLog(self._program))) # Validation has to occur *after* linking glValidateProgram(self._program) if glGetProgramiv(self._program, GL_VALIDATE_STATUS) == GL_FALSE: raise RuntimeError("Validation failure: %s"%(glGetProgramInfoLog(self._program))) - if glGetProgramiv(self._program, GL_LINK_STATUS) == GL_FALSE: - raise RuntimeError("Link failure: %s" % (glGetProgramInfoLog(self._program))) glDeleteShader(vertexShader) glDeleteShader(fragmentShader) except RuntimeError, e: -- 2.30.2