Start by loading the shader files into std::string:
std::string vertCode = loadShaderCode("separable.vert.glsl");std::string fragCode1 = loadShaderCode("separable1.frag.glsl");std::string fragCode2 = loadShaderCode("separable2.frag.glsl");
Next, we'll create one shader program for each using glCreateShaderProgramv:
GLuint programs[3];const GLchar * codePtrs = {vertCode.c_str(), fragCode1.c_str(), fragCode2.c_str()};programs[0] = glCreateShaderProgramv(GL_VERTEX_SHADER, 1, codePtrs);programs[1] = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, codePtrs + 1);programs[2] = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, codePtrs + 2);// Check for errors...
Now, we'll create two program pipelines. The first will use the vertex ...