Override context creation in GLArea.

This allows forward compatible and debug contexts to be created, and
provides more descriptive exceptions in the case where the context
cannot be created with the requested settings.
This commit is contained in:
Jarl Gullberg 2017-10-01 20:11:58 +02:00
parent b1f90c380e
commit d3f5a87809
No known key found for this signature in database
GPG key ID: FBB69BD7CAE095A0

View file

@ -109,6 +109,22 @@ namespace OpenTK
return true;
}
/// <inheritdoc />
protected override GLContext OnCreateContext()
{
var gdkGLContext = Window.CreateGlContext();
GetRequiredVersion(out var major, out var minor);
gdkGLContext.SetRequiredVersion(major, minor);
gdkGLContext.DebugEnabled = GraphicsContextFlags.HasFlag(GraphicsContextFlags.Debug);
gdkGLContext.ForwardCompatible = GraphicsContextFlags.HasFlag(GraphicsContextFlags.ForwardCompatible);
gdkGLContext.Realize();
return gdkGLContext;
}
/// <summary>
/// Destructs this object.
/// </summary>