From 1e69b9013970c19c8abc15c90b266581d906836d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Ignacio=20Aramend=C3=ADa?= Date: Sun, 6 Aug 2017 15:44:22 -0300 Subject: [PATCH] Fix wrong parameter in CheckShaderError after validating program The parameter to the glGetProgramiv for checking the validation status of the program should be GL_VALIDATE_STATUS, otherwise the error would be reported incorrectly or not at all. --- shader.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shader.cpp b/shader.cpp index 72e3a32..6e0974b 100644 --- a/shader.cpp +++ b/shader.cpp @@ -3,23 +3,23 @@ #include Shader::Shader(const std::string& fileName) -{ +{ m_program = glCreateProgram(); m_shaders[0] = CreateShader(LoadShader(fileName + ".vs"), GL_VERTEX_SHADER); m_shaders[1] = CreateShader(LoadShader(fileName + ".fs"), GL_FRAGMENT_SHADER); for(unsigned int i = 0; i < NUM_SHADERS; i++) glAttachShader(m_program, m_shaders[i]); - - glBindAttribLocation(m_program, 0, "position"); - glBindAttribLocation(m_program, 1, "texCoord"); - glBindAttribLocation(m_program, 2, "normal"); + + glBindAttribLocation(m_program, 0, "position"); + glBindAttribLocation(m_program, 1, "texCoord"); + glBindAttribLocation(m_program, 2, "normal"); glLinkProgram(m_program); CheckShaderError(m_program, GL_LINK_STATUS, true, "Error linking shader program"); glValidateProgram(m_program); - CheckShaderError(m_program, GL_LINK_STATUS, true, "Invalid shader program"); + CheckShaderError(m_program, GL_VALIDATE_STATUS, true, "Invalid shader program"); m_uniforms[0] = glGetUniformLocation(m_program, "MVP"); m_uniforms[1] = glGetUniformLocation(m_program, "Normal"); @@ -115,4 +115,4 @@ GLuint Shader::CreateShader(const std::string& text, unsigned int type) CheckShaderError(shader, GL_COMPILE_STATUS, false, "Error compiling shader!"); return shader; -} +}