diff --git a/Source/OpenTK/Platform/Egl/EglContext.cs b/Source/OpenTK/Platform/Egl/EglContext.cs index 18976bc1..d0aa48b6 100644 --- a/Source/OpenTK/Platform/Egl/EglContext.cs +++ b/Source/OpenTK/Platform/Egl/EglContext.cs @@ -125,6 +125,12 @@ namespace OpenTK.Platform.Egl } set { + if (value < 0) + { + // EGL does not offer EXT_swap_control_tear yet + value = 1; + } + if (Egl.SwapInterval(WindowInfo.Display, value)) swap_interval = value; else diff --git a/Source/OpenTK/Platform/MacOS/CocoaContext.cs b/Source/OpenTK/Platform/MacOS/CocoaContext.cs index 342f68b4..bf924477 100644 --- a/Source/OpenTK/Platform/MacOS/CocoaContext.cs +++ b/Source/OpenTK/Platform/MacOS/CocoaContext.cs @@ -257,6 +257,11 @@ namespace OpenTK } set { + if (value < 0) + { + // NSOpenGL does not offer EXT_swap_control_tear yet + value = 1; + } SetContextValue(value, NSOpenGLContextParameter.SwapInterval); } } diff --git a/Source/OpenTK/Platform/Windows/WinGLContext.cs b/Source/OpenTK/Platform/Windows/WinGLContext.cs index 82c327eb..74a5009a 100644 --- a/Source/OpenTK/Platform/Windows/WinGLContext.cs +++ b/Source/OpenTK/Platform/Windows/WinGLContext.cs @@ -351,7 +351,7 @@ namespace OpenTK.Platform.Windows Wgl.SupportsFunction("wglGetSwapIntervalEXT") && Wgl.SupportsFunction("wglSwapIntervalEXT"); vsync_tear_supported = - Wgl.SupportsExtension(DeviceContext, "WGL_EXT_swap_tear"); + Wgl.SupportsExtension(DeviceContext, "WGL_EXT_swap_control_tear"); } base.LoadAll(); diff --git a/Source/OpenTK/Platform/X11/X11GLContext.cs b/Source/OpenTK/Platform/X11/X11GLContext.cs index ff557e97..e67c1514 100644 --- a/Source/OpenTK/Platform/X11/X11GLContext.cs +++ b/Source/OpenTK/Platform/X11/X11GLContext.cs @@ -30,6 +30,7 @@ namespace OpenTK.Platform.X11 IntPtr display; X11WindowInfo currentWindow; bool vsync_supported; + bool vsync_tear_supported; int swap_interval = 1; // As defined in GLX_SGI_swap_control readonly X11GraphicsMode ModeSelector = new X11GraphicsMode(); @@ -362,6 +363,11 @@ namespace OpenTK.Platform.X11 { if (vsync_supported) { + if (value < 0 && !vsync_tear_supported) + { + value = 1; + } + ErrorCode error_code = 0; using (new XLock(Display)) error_code = Glx.Sgi.SwapInterval(value); @@ -381,8 +387,10 @@ namespace OpenTK.Platform.X11 public override void LoadAll() { vsync_supported = - SupportsExtension(display, currentWindow, "SupportsExtension") && + SupportsExtension(display, currentWindow, "GLX_SGI_swap_control") && Glx.SupportsFunction("glXSwapIntervalSGI"); + vsync_tear_supported = + SupportsExtension(display, currentWindow, "GLX_EXT_swap_control_tear"); Debug.Print("Context supports vsync: {0}.", vsync_supported); base.LoadAll();