Index: source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp =================================================================== --- source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp +++ source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp @@ -576,7 +576,6 @@ // Send setup messages to game engine: - POST_MESSAGE(InitSDL, ()); POST_MESSAGE(SetCanvas, (static_cast(canvas), canvas->GetClientSize().GetWidth(), canvas->GetClientSize().GetHeight())); Index: source/tools/atlas/GameInterface/GameLoop.cpp =================================================================== --- source/tools/atlas/GameInterface/GameLoop.cpp +++ source/tools/atlas/GameInterface/GameLoop.cpp @@ -308,6 +308,10 @@ // Tell Atlas the location of the user config directory Atlas_SetConfigDirectory(paths.Config().string().c_str()); + // SDL must be call in the main thread on osx + SDL_InitSubSystem(SDL_INIT_VIDEO); + SDL_GL_LoadLibrary(nullptr); // NULL = use default + // Run the engine loop in a new thread pthread_t engineThread; pthread_create(&engineThread, NULL, RunEngine, reinterpret_cast(const_cast(&args))); Index: source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp =================================================================== --- source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp +++ source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp @@ -62,25 +62,6 @@ g_VideoMode.InitNonSDL(); } -MESSAGEHANDLER(InitSDL) -{ - UNUSED2(msg); - - // When using GLX (Linux), SDL has to load the GL library to find - // glXGetProcAddressARB before it can load any extensions. - // When running in Atlas, we skip the SDL video initialisation code - // which loads the library, and so SDL_GL_GetProcAddress fails (in - // ogl.cpp importExtensionFunctions). - // (TODO: I think this is meant to be context-independent, i.e. it - // doesn't matter that we're getting extensions from SDL-initialised - // GL stuff instead of from the wxWidgets-initialised GL stuff, but that - // should be checked.) - // So, make sure it's loaded: - SDL_InitSubSystem(SDL_INIT_VIDEO); - SDL_GL_LoadLibrary(NULL); // NULL = use default - // (it shouldn't hurt if this is called multiple times, I think) -} - MESSAGEHANDLER(InitGraphics) { UNUSED2(msg); Index: source/tools/atlas/GameInterface/Messages.h =================================================================== --- source/tools/atlas/GameInterface/Messages.h +++ source/tools/atlas/GameInterface/Messages.h @@ -37,9 +37,6 @@ // Initialise some engine code. Must be called before anything else. MESSAGE(Init, ); -// Initialise SDL-related code. Must be called before SetCanvas and InitGraphics. -MESSAGE(InitSDL, ); - // Initialise graphics-related code. Must be called after the first SetCanvas, // and before much else. MESSAGE(InitGraphics, );