More sane Sdl2Factory.CreateGetCurrentContext() implementation

This commit is contained in:
Stefanos A 2013-10-15 00:18:41 +02:00
parent 29fe1052de
commit e0ffd9b42d
2 changed files with 10 additions and 13 deletions

View file

@ -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();
};
}

View file

@ -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()