I am hoping to implement a shader on a 2D OpenGL application. My plan is to render a scene to a framebuffer object, and then render that framebuffer object to the screen using
There's indeed a problem with how you set the uniform value for the sampler:
gSampler = glGetUniformLocation(mProgramID, "gSampler");
glUniform1i(gSampler, GL_TEXTURE0);
The value you need to set for the uniform is the index of the texture unit, not the corresponding enum value. Since you are using texture unit 0 in this case, you need to replace the glUniform1i()
call by:
glUniform1i(gSampler, 0);