Reputation:
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?
Upvotes: 5
Views: 1719
Reputation: 8650
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.
Upvotes: 1