Hi folks,
I created a template project to develop OpenGL applications. I do window management with SFML/Window.
Let's say I created a "Shader" class, and there is function like "loadFromFile" similar to that of SFML and if this function loads shaders correctly it also calls function to compile shaders.
What approach should I take when I want to test the functions of this shader class?
We know that in order for any OpenGL commands to work, a context must be current. SFML's window class does this for us.
Do I need to create context like below for tests with opengl calls? Or how should I set up a structure for more isolated test codes?
TEST_CASE("Shader")
{
sf::ContextSettings settings;
settings.depthBits = 24;
settings.stencilBits = 8;
settings.majorVersion = 3;
settings.minorVersion = 3;
sf::Window window(sf::VideoMode(800, 600), "OpenGL Context", sf::Style::None, settings);
Shader shader;
CHECK(shader.loadFromFile("vertex.glsl", "fragment.glsl") == true);
}