Fix problems with ordering and dependencies when initializing OpenGL drawing context