Moved som methods to cpp file. Added method invokation, so OpenGL context gets only called by main thread.