Closed paroj closed 8 years ago
Original comment by Sand3r (Bitbucket: Sand3r, GitHub: Sand3r):
It is caused by the Framework::CreateProgram function which after the program linking calls the glDeleteShader on each entity of the shaderList vector.
The simplest solution is to replace the current InitializeProgram() code to:
#!c++
void InitializeProgram()
{
std::vector<GLuint> shaderList;
shaderList.push_back(Framework::LoadShader(GL_VERTEX_SHADER, "screenCoords.vert"));
shaderList.push_back(Framework::LoadShader(GL_FRAGMENT_SHADER, "textureNoGamma.frag"));
g_noGammaProgram = Framework::CreateProgram(shaderList);
shaderList.clear();
shaderList.push_back(Framework::LoadShader(GL_VERTEX_SHADER, "screenCoords.vert"));
shaderList.push_back(Framework::LoadShader(GL_FRAGMENT_SHADER, "textureGamma.frag"));
g_gammaProgram = Framework::CreateProgram(shaderList);
GLuint projectionBlock = glGetUniformBlockIndex(g_noGammaProgram, "Projection");
glUniformBlockBinding(g_noGammaProgram, projectionBlock, g_projectionBlockIndex);
GLuint colorTextureUnif = glGetUniformLocation(g_noGammaProgram, "colorTexture");
glUseProgram(g_noGammaProgram);
glUniform1i(colorTextureUnif, g_gammaRampTextureUnit);
glUseProgram(0);
projectionBlock = glGetUniformBlockIndex(g_gammaProgram, "Projection");
glUniformBlockBinding(g_gammaProgram, projectionBlock, g_projectionBlockIndex);
colorTextureUnif = glGetUniformLocation(g_gammaProgram, "colorTexture");
glUseProgram(g_gammaProgram);
glUniform1i(colorTextureUnif, g_gammaRampTextureUnit);
glUseProgram(0);
}
Pull request addressing this problem has been sent https://bitbucket.org/alfonse/gltut/pull-requests/7/fixed-the-bug-that-corrupted-the-gamma/diff
Originally reported by: Giuseppe Barbieri (Bitbucket: giuseppe_barbieri, GitHub: Unknown)
If I try to run the "Gamma Ramp" example I get the following