diff --git a/Source/OpenTK/Platform/SDL2/Sdl2Factory.cs b/Source/OpenTK/Platform/SDL2/Sdl2Factory.cs index 63350756..18a40a55 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2Factory.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2Factory.cs @@ -69,19 +69,7 @@ namespace OpenTK.Platform.SDL2 // so we need to implement our own. return (GraphicsContext.GetCurrentContextDelegate)delegate { - IntPtr current; - if (Configuration.RunningOnWindows) - current = OpenTK.Platform.Windows.Wgl.Imports.GetCurrentContext(); - else if (Configuration.RunningOnX11) - current = OpenTK.Platform.X11.Glx.GetCurrentContext(); - else if (Configuration.RunningOnMacOS) - current = OpenTK.Platform.MacOS.Cgl.GetCurrentContext(); - else if (Configuration.RunningOnAndroid) - current = OpenTK.Platform.Egl.Egl.GetCurrentContext(); - else - throw new NotSupportedException("Unknown platform, please report to http://www.opentk.com"); - - return new ContextHandle(current); + return Sdl2GraphicsContext.GetCurrentContext(); }; } diff --git a/Source/OpenTK/Platform/SDL2/Sdl2GraphicsContext.cs b/Source/OpenTK/Platform/SDL2/Sdl2GraphicsContext.cs index 997e1610..b423b684 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2GraphicsContext.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2GraphicsContext.cs @@ -254,6 +254,15 @@ namespace OpenTK.Platform.SDL2 #endregion + #region Public Members + + public static ContextHandle GetCurrentContext() + { + return new ContextHandle(SDL.GL.GetCurrentContext()); + } + + #endregion + #region GraphicsContextBase Members public override void SwapBuffers()