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.
This commit is contained in:
Jonas Boesch 2015-04-21 16:08:20 +02:00 committed by Manuel Zanin
parent 1581ac7b8a
commit 7b795a02e1

View file

@ -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
}
}