I’m writing a small OpenGL program, where I’ve initialised an glfw context and a window is visible. However the shader program that I’ve written (and verified compilation and linkage with glGetShaderiv
and glGetProgramiv
with the appropriate arguments) does not seem to change the currently used program when I set it:
// Earlier in the program
if (!glfwInit())
{
// Graceful exit
}
if(glewInit() != GLEW_OK)
{
// ...
}
// --snip--
glUseProgram(glShader->id());
int currentProgram{};
glGetIntegerv(GL_CURRENT_PROGRAM, ¤tProgram);
assert(currentProgram == glShader->id() &&
"Shader program was not updated.");
In fact, whatever junk value I put into ¤tProgram
gets thrown right back at me. I suspect something is not initialised when it should be, but I can’t discern what.
P.S. The OpenGL tutorial example here compiles and runs fine for me. Also, here are some logs I generated while running my program.