mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 01:15:26 +00:00
GLControl requires native backend
SDL does not currently support embedding into Windows Forms (this is an upstream limitation.) To ensure that existing WinForms applications continue to function even if SDL is installed, GLControl will now try to initialize OpenTK with a native backend. The user can still override this behavior using OpenTK.Toolkit.Init(ToolkitOptions), as normal.
This commit is contained in:
parent
b9fcf7c3c3
commit
ab58d41353
|
@ -92,6 +92,18 @@ namespace OpenTK
|
|||
{
|
||||
if (mode == null)
|
||||
throw new ArgumentNullException("mode");
|
||||
|
||||
// SDL does not currently support embedding
|
||||
// on external windows. If Open.Toolkit is not yet
|
||||
// initialized, we'll try to request a native backend
|
||||
// that supports embedding.
|
||||
// Most people are using GLControl through the
|
||||
// WinForms designer in Visual Studio. This approach
|
||||
// works perfectly in that case.
|
||||
Toolkit.Init(new ToolkitOptions
|
||||
{
|
||||
Backend = PlatformBackend.PreferNative
|
||||
});
|
||||
|
||||
SetStyle(ControlStyles.Opaque, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
|
|
Loading…
Reference in a new issue