예제 #1
0
        static Application()
        {
            if (!GLib.Thread.Supported)
            {
                GLib.Thread.Init();
            }

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
            case PlatformID.Win32S:
            case PlatformID.Win32Windows:
            case PlatformID.WinCE:
                Win32CreateWindow  = FuncLoader.LoadFunction <d_Win32CreateWindow>(FuncLoader.GetProcAddress(GLibrary.Load("user32.dll"), "CreateWindowExW"));
                Win32DestroyWindow = FuncLoader.LoadFunction <d_Win32DestroyWindow>(FuncLoader.GetProcAddress(GLibrary.Load("user32.dll"), "DestroyWindow"));

                // No idea why we need to create that window, but it enables visual styles on the Windows platform
                IntPtr window = Win32CreateWindow(WS_EX_TOOLWINDOW, "static", "gtk-sharp visual styles window", WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
                Win32DestroyWindow(window);
                break;

            default:
                break;
            }
        }
예제 #2
0
        static partial void LoadPlatformEntryPoints()
        {
            Android.Util.Log.Verbose("GL", "Loading Entry Points");

            var eglBindLoaded = false;

            try
            {
                BindAPI       = FuncLoader.LoadFunction <BindAPIDelegate>(libGL, "eglBindAPI", true);
                eglBindLoaded = true;
            }
            catch { }

            var supportsFullGL = eglBindLoaded && BindAPI(RenderApi.GL);

            if (!supportsFullGL)
            {
                if (eglBindLoaded)
                {
                    BindAPI(RenderApi.ES);
                }
                BoundApi = RenderApi.ES;
            }

            Android.Util.Log.Verbose("GL", "Bound {0}", BoundApi);

            if (BoundApi == RenderApi.ES && libES3 != IntPtr.Zero)
            {
                Library = libES3;
            }

            if (BoundApi == RenderApi.ES && libES2 != IntPtr.Zero)
            {
                Library = libES2;
            }
            else if (BoundApi == RenderApi.GL && libGL != IntPtr.Zero)
            {
                Library = libGL;
            }
        }
예제 #3
0
 private static T LoadFunction <T>(string function, bool throwIfNotFound = false)
 {
     return(FuncLoader.LoadFunction <T>(Library, function, throwIfNotFound));
 }