Compile/Link InfoLog is empty

Hello,

I’m trying to compile and like a very simple shader and to test the InfoLogs I made a syntax-errors (in the vert-shader) on purpose. Problem is, that neither the compile-log nor the link-log are filled properly:
I’m running a Intel HD4000 and use this two functions in C++:

void ShaderProgram::checkCompilationGL(int handle) {
	GLint status = 0;
	glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
	if(status == GL_FALSE) {
		GLint infoLogLength = 0;
		glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &infoLogLength);
		GLchar* infoLog = new GLchar[infoLogLength + 1];
		glGetShaderInfoLog(handle, infoLogLength, 0, infoLog);
		
		std::cout << infoLogLength << std::endl;
		std::cout << "Error while compiling shader: " << id << std::endl;
		std::cout << *infoLog << std::endl;

		delete[] infoLog;
	}
}

void ShaderProgram::checkValidationGL() {
	GLint status = 0;
	glGetProgramiv(programHandle, GL_LINK_STATUS, &status);
	if(status == GL_FALSE) {
		GLint infoLogLength;
		glGetProgramiv(programHandle, GL_INFO_LOG_LENGTH, &infoLogLength);
		GLchar* infoLog = new GLchar[infoLogLength + 1];
		glGetProgramInfoLog(programHandle, infoLogLength, 0, infoLog);

		std::cout << infoLogLength << std::endl;
		std::cout << "Error while linking shader: " << id << std::endl;
		std::cout << *infoLog << std::endl;
		
		delete[] infoLog;
	}
}

Output is:

94
Error while compiling shader: test
E

1
Error while linking shader

Why doesnt the array get filled as it should be?

Thanks!

You’re printing the string wrong.

std::cout << *infoLog << std::endl;

If you have a char*, and you dereference it, you have a char. Namely, the first character. Which is exactly what you printed.

If you want to print the string, then pass the whole string:

std::cout << infoLog << std::endl;

Stupid me … thanks!