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:
parent
b1f90c380e
commit
d3f5a87809
1 changed files with 16 additions and 0 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue