-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Under WIndows, for WinForms or WPF, I get an error if I try to use the OpenGL backend by forcing it in the MainForm constructor :
public MainForm(GraphicsBackend backend)
{
InitializeComponent();
backend = GraphicsBackend.OpenGL;
Shown += (sender, e) => FormReady = true;
Hardware tested is a laptop targeted 3070 running 471.96 drivers, and also a desktop 1070 with the same drivers. Both fail in the same manner. Direct3D11 and Vulkan backends work without issue, I see the same crash for the PR that attempts to make OpenGL work with GTK
Crash is :
System.InvalidCastException: Unable to cast object of type 'Eto.Veldrid.Wpf.WpfVeldridSurfaceHandler' to type 'IOpenGL'.
at Eto.Veldrid.VeldridSurface.get_OpenGL() in D:\development\git\Eto.Veldrid\src\Eto.Veldrid\VeldridSurface.cs:line 54
at Eto.Veldrid.VeldridSurface.InitializeGraphicsBackend(InitializeEventArgs e) in D:\development\git\Eto.Veldrid\src\Eto.Veldrid\VeldridSurface.cs:line 154
at Eto.Veldrid.VeldridSurface.Callback.OnInitializeBackend(VeldridSurface s, InitializeEventArgs e) in D:\development\git\Eto.Veldrid\src\Eto.Veldrid\VeldridSurface.cs:line 33
at Eto.Veldrid.Wpf.WpfVeldridSurfaceHandler.Control_Loaded(Object sender, RoutedEventArgs e) in D:\development\git\Eto.Veldrid\src\Eto.Veldrid.Wpf\WpfVeldridSurfaceHandler.cs:line 58
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)
at System.Windows.Interop.HwndTarget.OnResize()
at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)