Dear Sir/Madam,
When checking for errors on the linking and compiling of my shaderProgram it seemed like it does not compile. I have no clue why not so I implemented an errorlog method:
bool Material::CheckCompileErrors(GLuint id, CompiledObjectType type) const
{
GLchar infoLog[1024];
GLint success = 0;
switch(type)
{
case shader:
glGetShaderiv(id, GL_COMPILE_STATUS, &success);
if (success) return true;
glGetShaderInfoLog(id, 1024, nullptr, infoLog);
std:: printf("%s", infoLog);
break;
case program:
glGetProgramiv(id, GL_LINK_STATUS, &success);
if (success) return true;
glGetProgramInfoLog(id, 1024, nullptr, infoLog);
std:: printf("%s", infoLog);
break;
default:
assert("That is not a valid type to check for.");
break;
}
return false;
}
The purpose of it is to return true when compiling/linking went right and when something goes wrong it should log the error, but instead of logging (in this case the linking error) in logs a lot of garbage. I have no clue why it does this, it makes it almost impossible to debug.
If you do know why the glGetPrograminfoLog doesn’t want to fill my infolog array (which is a technically a pointer which it requires) please inform me of what I’m doing wrong.
One last thing, the reason I posted this in the GLSL thread and not in the general is because there was no “post new thread” button.
Cheers,
Geomazzix