Initialize an OpenTK::GraphicsContext from the foreign GDK context.

This commit is contained in:
Jarl Gullberg 2017-09-15 11:51:11 +02:00
parent d677aef6c3
commit 456d7cde37
No known key found for this signature in database
GPG key ID: FBB69BD7CAE095A0

View file

@ -386,9 +386,14 @@ namespace OpenTK
_WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, widgetWindowHandle, this.Screen.RootWindow.Handle);
}
// GraphicsContext
// Make the GDK GL context current
Context.MakeCurrent();
_GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, GraphicsContextFlags);
// Create an OpenTK graphics context using the GdkGLContext as a foreign context
// Since the GDK context is already created and has been made current, we can retrieve its handle.
var gdkContextHandle = Factory.Default.CreateGetCurrentGraphicsContext()();
_GraphicsContext = new GraphicsContext(gdkContextHandle, _WindowInfo, null, GlVersionMajor, GlVersionMinor, GraphicsContextFlags);
_GraphicsContext.MakeCurrent(_WindowInfo);
if (GraphicsContext.ShareContexts)