Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -53,6 +53,10 @@ ; Preferred display (for multidisplay setups, only works with SDL 2.0) display = 0 +; Sets the swap interval for the current OpenGL context. Valid values are 0 (disabled), 1 (vsync) and -1 (adaptive vsync). +; Adaptive vsync might not be supported on all systems see https://wiki.libsdl.org/SDL_GL_SetSwapInterval for more information. +sdl.swapinterval = 1 + ; Emulate right-click with Ctrl+Click on Mac mice macmouse = false Index: source/lib/sysdep/os/win/wgl.h =================================================================== --- source/lib/sysdep/os/win/wgl.h +++ source/lib/sysdep/os/win/wgl.h @@ -72,21 +72,3 @@ DECLARE_HANDLE(HDC); DECLARE_HANDLE(HGLRC); #endif - -// VC6 doesn't define wchar_t as built-in type -#ifndef _WCHAR_T_DEFINED -typedef unsigned short wchar_t; // for glu.h -#define _WCHAR_T_DEFINED -#endif - -WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC, HGLRC, UINT); -WINGDIAPI HGLRC WINAPI wglCreateContext(HDC); -WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC, int); -WINGDIAPI BOOL WINAPI wglDeleteContext(HGLRC); -WINGDIAPI HGLRC WINAPI wglGetCurrentContext(); -WINGDIAPI HDC WINAPI wglGetCurrentDC(); -WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR); -WINGDIAPI BOOL WINAPI wglMakeCurrent(HDC, HGLRC); -WINGDIAPI BOOL WINAPI wglShareLists(HGLRC, HGLRC); -WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD); -WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD); Index: source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp =================================================================== --- source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp +++ source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp @@ -558,12 +558,7 @@ m_SectionLayout.Build(*this); -#if defined(__WXMSW__) - // The canvas' context gets made current on creation; but it can only be - // current for one thread at a time, and it needs to be current for the - // thread that is doing the draw calls, so disable it for this one. - wglMakeCurrent(NULL, NULL); -#elif defined(__WXGTK__) || defined(__WXOSX__) || defined(__WXMAC__) +#if defined(__WXGTK__) || defined(__WXOSX__) || defined(__WXMAC__) // Need to make sure the canvas is realised, so that its context is valid // this solves the "invalid drawable" error Show(true); Index: source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp =================================================================== --- source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp +++ source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp @@ -29,6 +29,7 @@ #include "lib/ogl.h" #include "maths/MathUtil.h" #include "ps/CConsole.h" +#include "ps/ConfigDB.h" #include "ps/Game.h" #include "ps/VideoMode.h" #include "ps/GameSetup/Config.h" @@ -88,12 +89,10 @@ InitGraphics(g_AtlasGameLoop->args, g_InitFlags, {}); -#if OS_WIN - // HACK (to stop things looking very ugly when scrolling) - should - // use proper config system. - if(ogl_HaveExtension("WGL_EXT_swap_control")) - pwglSwapIntervalEXT(1); -#endif + // HACK (to stop things looking very ugly when scrolling) + int interval = 1; + CFG_GET_VAL("sdl.swapinterval", interval); + SDL_GL_SetSwapInterval(interval); }