Browse Source

move check before MakeCurrent

pull/9408/head
Emmanuel Hansen 4 years ago
parent
commit
8f6e9f1d0d
  1. 7
      src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs

7
src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs

@ -44,14 +44,15 @@ namespace Avalonia.OpenGL.Egl
public IGlContext CreateContext() => Display.CreateContext(null);
public IGlContext CreateSharedContext() => Display.CreateContext(PrimaryEglContext);
public EglSurface CreateWindowSurface(IntPtr window)
{
if (window == IntPtr.Zero)
throw new OpenGlException($"Window {window} is invalid.");
using (PrimaryContext.MakeCurrent())
{
if(window == IntPtr.Zero)
throw new OpenGlException($"Window {window} is invalid.");
var s = Display.EglInterface.CreateWindowSurface(Display.Handle, Display.Config, window,
new[] { EGL_NONE, EGL_NONE });
if (s == IntPtr.Zero)

Loading…
Cancel
Save