Load our shader program

main.cpp

Read shader files

We are going to use Shader::read_source to read our vertex and fragment shader program in main()

    // Initialize shader with VSCode
    shader.read_source( "../shaders/colour.vert", "../shaders/colour.frag");
    // use the following if you are using Visual Studio
    // shader.read_source( "shaders/colour.vert", "shaders/colour.frag");
    shader.compile();
    glUseProgram(shader.program);

Note: from LabA03, with the updated CMakeLists.txt, we will have uniform access of the shader files for both VSCode and Visuali Studio :

shader.read_source( "shaders/colour.vert", "shaders/colour.frag");

Finally, we get

Last updated