glUseProgram

I don't know why glUseProgram(0) prevents rendering operations here

1
2
3
4
5
6
7
8
9
10
while (!done)
{
    // ...

    glUseProgram(myProgram);
    renderer->DrawEntities();
    glUseProgram(0); // I only see my entities when I remove this line, why?

    // ...
}


Everything works fine until I switch the shader program, what could the problem be
Last edited on
Probably a bit more context is needed. What happens inside DrawEntities? What draw calls are used?

What happens (roughly) in the two places you have "// ..."?

Edit:
Also, are you calling the OpenGL functions to get what errors have happened?

You can use a simple function like
1
2
3
4
5
6
7
void checkGLError()
{
    GLenum err;
    while((err = glGetError()) != GL_NO_ERROR){
        std::cout << err << ' ';
    }  
}

to view any errors that are present after any API call.

Figure out which GL call is the first to produce an error.
Last edited on
I somehow managed to fix the error by rewriting the entire shader class :), thanks for your quick reply though, your checkGLError helped me solve another problem LOL so thanks again
Last edited on
Topic archived. No new replies allowed.