From 7b795a02e108ad272138a355557865238f0d2b26 Mon Sep 17 00:00:00 2001 From: Jonas Boesch Date: Tue, 21 Apr 2015 16:08:20 +0200 Subject: [PATCH] Bugfix: Non-null shared contexts for Egl threw Exception The shared context parameter can be either the EglContext directly, or the facade, and we cast to see what it is. --- src/OpenTK/Platform/Egl/EglContext.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/OpenTK/Platform/Egl/EglContext.cs b/src/OpenTK/Platform/Egl/EglContext.cs index b6cca8f..2844686 100644 --- a/src/OpenTK/Platform/Egl/EglContext.cs +++ b/src/OpenTK/Platform/Egl/EglContext.cs @@ -53,6 +53,8 @@ namespace OpenTK.Platform.Egl if (window == null) throw new ArgumentNullException("window"); + EglContext shared = GetSharedEglContext(sharedContext); + WindowInfo = window; // Select an EGLConfig that matches the desired mode. We cannot use the 'mode' @@ -216,6 +218,21 @@ namespace OpenTK.Platform.Egl } } + private EglContext GetSharedEglContext(IGraphicsContext sharedContext) + { + if (sharedContext == null) + { + return null; + } + + var internalContext = sharedContext as IGraphicsContextInternal; + if (internalContext != null) + { + return (EglContext) internalContext.Implementation; + } + return (EglContext) sharedContext; + } + #endregion } } -- 2.7.4