5
votes

I'm initializing my OpenGL context(SDL/GLEW) in the main thread. But rendering is done in a different thread(things like SDL_GL_SwapWindow or glDrawElements).

The thing is, that nothing happens if I call SDL_GL_SwapWindow. I was trying to simply change the clear color after every swap, but nothing happens.

void render(){
    // Rendering... 
}

int main(){
    // Initialization... 

    thread rendering(render);
}

Could this be problem?

1

1 Answers

3
votes

Not going to work as you expect. OpenGL Context is thread local. Whichever thread you create the context is where the actual OpenGL rendering calls will have to be made from.