Using shaders
The standardization of the programmable pipeline now means shaders have to be written for certain tasks, including the basic ones. This means that simply submitting our vertex data and rendering it would do nothing, as the two fundamental chunks of the rendering pipeline, the vertex and fragment shaders, are non-existent. In this section, we are going to cover how shaders are loaded, built, and applied to our virtual geometry, in turn producing those glorious pixels on the screen.
Loading shader files
Before we can use shaders, we must first discuss how they are loaded. All we technically need to create a shader is a string, containing all of its code. A very simple helper function can be written to parse a file and return it as a string, as shown here:
inline std::string ReadFile(const std::string& l_filename) { std::ifstream file(l_filename); if (!file.is_open()) { return ""; } std::string output; std::string line; while (std::getline(file, line)) { output...