opengl-tutorials
opengl-tutorials copied to clipboard
compileErrors() doesn't work as intended
// Checks if the different Shaders have compiled properly
void Shader::compileErrors(unsigned int shader /* Sidenote: shouldn't this be GLuint for maximum generality? */, const char* type)
{
// ...
if (type != "PROGRAM") // This is never true because const char* is not std::string and this simply compares the memory addresses. If you want to check to see if the values aren't the same use strcmp(type, program) != 0 in <cstring>
{
// ...
}
else
{
// ...
}
}
My personal fix for this was to change the comparison to if (shader != ID), which I think is overall better than making it actually compare the string properly. Could also rename the variables and add a comment to make the comparison more clear.
i guess author abandon this... i come here to wrote this issue, and also seen it