diff --git a/src/Beutl.Graphics/Rendering/SharedGRContext.cs b/src/Beutl.Graphics/Rendering/SharedGRContext.cs index 62b106a82..617585add 100644 --- a/src/Beutl.Graphics/Rendering/SharedGRContext.cs +++ b/src/Beutl.Graphics/Rendering/SharedGRContext.cs @@ -18,7 +18,8 @@ public static GRContext GetOrCreate() { RenderThread.Dispatcher.VerifyAccess(); GLFW.Init(); - ThrowGLFWError(); + if (GLFW.GetError(out _) is not ErrorCode.NoError) + return null; GLFW.DefaultWindowHints(); GLFW.WindowHint(WindowHintOpenGlProfile.OpenGlProfile, OpenGlProfile.Core); @@ -27,9 +28,10 @@ public static GRContext GetOrCreate() GLFW.WindowHint(WindowHintInt.ContextVersionMinor, 3); GLFW.WindowHint(WindowHintBool.Visible, false); s_window = GLFW.CreateWindow(1, 1, string.Empty, null, null); - + GLFW.MakeContextCurrent(s_window); - ThrowGLFWError(); + if (GLFW.GetError(out _) is not ErrorCode.NoError) + return null; GRContext = GRContext.CreateGl(); } @@ -49,14 +51,4 @@ public static void Shutdown() } }); } - - private static void ThrowGLFWError() - { - var result = GLFW.GetError(out var description); - - if (result is not ErrorCode.NoError) - { - throw new GraphicsException(description); - } - } }