From a4e1d3862858bb6c4112342c99fab855fb9494e3 Mon Sep 17 00:00:00 2001 From: unodgs Date: Wed, 28 Aug 2013 21:23:34 +0000 Subject: [PATCH] CoreGl: Fixed checking program linking status git-svn-id: svn://ultimatepp.org/upp/trunk@6288 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- rainbow/CoreGl/Shaders.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rainbow/CoreGl/Shaders.cpp b/rainbow/CoreGl/Shaders.cpp index 87330aed4..4ef315faa 100644 --- a/rainbow/CoreGl/Shaders.cpp +++ b/rainbow/CoreGl/Shaders.cpp @@ -81,7 +81,7 @@ bool Shader::IsProgramCompiled(int program) bool Shader::IsProgramLinked(int program) { GLint result = GL_FALSE; - glGetShaderiv(program, GL_LINK_STATUS, &result); + glGetProgramiv(program, GL_LINK_STATUS, &result); return result == GL_TRUE; } @@ -106,6 +106,7 @@ int Shader::CompileProgram(const char* vs, const char* fs) { PrintShaderInfoLog(vertexShader, "shader_vertex.log"); error = "Vertex shader compilation error:\n\n" + compileError; + glDeleteShader(vertexShader); return -1; } @@ -117,6 +118,7 @@ int Shader::CompileProgram(const char* vs, const char* fs) { PrintShaderInfoLog(fragmentShader, "shader_fragment.log"); error = "Fragment shader compilation error:\n\n" + compileError; + glDeleteShader(fragmentShader); return -1; } @@ -131,7 +133,8 @@ int Shader::CompileProgram(const char* vs, const char* fs) { PrintProgramInfoLog(program, "shader_link.log"); PrintProgramValidationLog(program, "shader_validation.log"); - return -1; + glDeleteProgram(program); + program = -1; } } else