public static void Initialize() { AvaloniaLocator.CurrentMutable.Bind <IPlatformOpenGlInterface>().ToLazy <IPlatformOpenGlInterface>(() => { var opts = AvaloniaLocator.Current.GetService <Win32PlatformOptions>(); if (opts?.UseWgl == true) { var wgl = WglPlatformOpenGlInterface.TryCreate(); return(wgl); } if (opts?.AllowEglInitialization ?? Win32Platform.WindowsVersion > Windows7) { var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); if (egl != null && opts?.UseWindowsUIComposition == true) { WinUICompositorConnection.TryCreateAndRegister(egl); } return(egl); } return(null); }); }
public static void Initialize() { AvaloniaLocator.CurrentMutable.Bind <IPlatformOpenGlInterface>().ToLazy <IPlatformOpenGlInterface>(() => { var opts = AvaloniaLocator.Current.GetService <Win32PlatformOptions>(); if (opts?.UseWgl == true) { var wgl = WglPlatformOpenGlInterface.TryCreate(); return(wgl); } if (opts?.AllowEglInitialization == true) { var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); if (egl is { } && opts?.UseWindowsUIComposition == true && Win32Platform.WindowsVersion.Major >= 10 && Win32Platform.WindowsVersion.Build >= 16299) { AvaloniaLocator.CurrentMutable.BindToSelf(new CompositionConnector(egl)); } return(egl); }
public static void Initialize() { AvaloniaLocator.CurrentMutable.Bind <IPlatformOpenGlInterface>().ToLazy <IPlatformOpenGlInterface>(() => { var opts = AvaloniaLocator.Current.GetService <Win32PlatformOptions>(); if (opts?.UseWgl == true) { var wgl = WglPlatformOpenGlInterface.TryCreate(); return(wgl); } if (opts?.AllowEglInitialization == true) { return(EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay())); } return(null); }); }
public static void Initialize() { AvaloniaLocator.CurrentMutable.Bind <IPlatformOpenGlInterface>().ToLazy <IPlatformOpenGlInterface>(() => { var opts = AvaloniaLocator.Current.GetService <Win32PlatformOptions>() ?? new Win32PlatformOptions(); if (opts.UseWgl) { var wgl = WglPlatformOpenGlInterface.TryCreate(); return(wgl); } if (opts.AllowEglInitialization ?? Win32Platform.WindowsVersion > PlatformConstants.Windows7) { var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); if (egl != null) { if (opts.EglRendererBlacklist != null) { foreach (var item in opts.EglRendererBlacklist) { if (egl.PrimaryEglContext.GlInterface.Renderer.Contains(item)) { return(null); } } } if (opts.UseWindowsUIComposition) { WinUICompositorConnection.TryCreateAndRegister(egl, opts.CompositionBackdropCornerRadius); } } return(egl); } return(null); }); }