With my class I have simplified shader loading and attaching to a very minimal level:
Shader shader;
shader.load("vertex_shader.txt", GL_VERTEX_SHADER);
shader.load("fragment_shader.txt", GL_FRAGMENT_SHADER);
shader.use();
void Render()
{
...
glUniformMatrix4fv(shader["world"], 1, GL_FALSE, glm::value_ptr(model));
...
}
No need to compile link and attach. It is all taken care of! Error messages (if any) are printed out to the stdout too!
NOTE: I am a beginner, so use this code carefully, probably has many bugs. To use this, you only need to include shader.hpp.
Any recommendations are welcome.
Also if you’d like to show off your shader handling code, you can do it here now too