From e0ffd9b42d1dbb3bf85624c7c24dcb11246d9132 Mon Sep 17 00:00:00 2001 From: Stefanos A Date: Tue, 15 Oct 2013 00:18:41 +0200 Subject: [PATCH] More sane Sdl2Factory.CreateGetCurrentContext() implementation --- Source/OpenTK/Platform/SDL2/Sdl2Factory.cs | 14 +------------- Source/OpenTK/Platform/SDL2/Sdl2GraphicsContext.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 13 deletions(-) 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()