diff --git a/Source/OpenTK/Configuration.cs b/Source/OpenTK/Configuration.cs index 4ee7bb5f..98b21d68 100644 --- a/Source/OpenTK/Configuration.cs +++ b/Source/OpenTK/Configuration.cs @@ -38,7 +38,10 @@ namespace OpenTK /// Provides information about the underlying OS and runtime. public static class Configuration { - static bool runningOnWindows, runningOnUnix, runningOnX11, runningOnMacOS, runningOnLinux, runningOnMono; + static bool runningOnWindows, runningOnUnix, runningOnX11, runningOnMacOS, runningOnLinux; + static bool runningOnMono; + static bool runningOnAndroid; + static bool? sdl2supported; volatile static bool initialized; readonly static object InitLock = new object(); @@ -114,6 +117,26 @@ namespace OpenTK #endregion + #region public static bool RunningOnAndroid + + /// + /// Gets a System.Boolean indicating whether + /// OpenTK is running on an Android device. + /// + public static bool RunningOnAndroid + { + get + { +#if ANDROID + return true; +#else + return false; +#endif + } + } + + #endregion + #region --- Private Methods --- #region private static string DetectUnixKernel() diff --git a/Source/OpenTK/Platform/SDL2/Sdl2Factory.cs b/Source/OpenTK/Platform/SDL2/Sdl2Factory.cs index 4992f243..63350756 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2Factory.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2Factory.cs @@ -76,6 +76,8 @@ namespace OpenTK.Platform.SDL2 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");