Fix wrong threaded usage of OpenGL context.

This fixes crashes on all platform when rendering to the screen.