Added demo handling and easyloggingpp

This commit is contained in:
2022-04-24 07:15:30 +03:00
parent 674191238f
commit bd57437953
30 changed files with 1617 additions and 162 deletions
+26 -1
View File
@@ -14,11 +14,34 @@ void check_compile_error(GLuint shaderId) {
char errorLog[maxLength];
glGetShaderInfoLog(shaderId, maxLength, &maxLength, &errorLog[0]);
std::cout << "Shader error: " << errorLog << std::endl;
LOG(ERROR) << "Shader compile error: (" << isCompiled << ") - " << std::string(errorLog);
//Provide the infolog in whatever manor you deem best.
//Exit with failure.
glDeleteShader(shaderId); //Don't leak the shader.
} else {
LOG(INFO) << "Shader successfully compiled";
}
}
void check_link_error(GLuint program_id) {
GLint is_linked = 0;
glGetShaderiv(program_id, GL_LINK_STATUS, &is_linked);
if (is_linked == GL_FALSE) {
GLint maxLength = 0;
glGetShaderiv(program_id, GL_INFO_LOG_LENGTH, &maxLength);
//The maxLength includes the NULL character
char errorLog[maxLength];
glGetShaderInfoLog(program_id, maxLength, &maxLength, &errorLog[0]);
LOG(ERROR) << "Shader program link error: " << "(" << is_linked << ") - " << std::string(errorLog);
//Provide the info log in whatever manner you deem best.
//Exit with failure.
glDeleteShader(program_id); //Don't leak the program shader.
} else {
LOG(INFO) << "Shader program successfully linked";
}
}
@@ -44,6 +67,8 @@ shader::shader(const char *vs_content, const char *ps_content) {
glBindAttribLocation(program_id, 2, "texCoords");
glLinkProgram(program_id);
check_link_error(program_id);
glUseProgram(program_id);
}