mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-24 06:56:53 +00:00
* GLControlFactory.cs: More defensive checks for null GraphicsModes.
* GLControl.cs: More defensive checks for null GraphicsModes. Set flags, context version and GraphicsMode before calling InitializeComponents(), as the latter might cause the context to be created (and we need this information before creating the context). Fixes ArgumentNullException on Linux.
This commit is contained in:
parent
0c9657c5e7
commit
a58fe9e70e
|
@ -78,17 +78,20 @@ namespace OpenTK
|
|||
/// <param name="flags">The GraphicsContextFlags for the OpenGL GraphicsContext.</param>
|
||||
public GLControl(GraphicsMode mode, int major, int minor, GraphicsContextFlags flags)
|
||||
{
|
||||
if (mode == null)
|
||||
throw new ArgumentNullException("mode");
|
||||
|
||||
SetStyle(ControlStyles.Opaque, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
DoubleBuffered = false;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
this.format = mode;
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.flags = flags;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -38,6 +38,11 @@ namespace OpenTK
|
|||
{
|
||||
public IGLControl CreateGLControl(GraphicsMode mode, Control control)
|
||||
{
|
||||
if (mode == null)
|
||||
throw new ArgumentNullException("mode");
|
||||
if (control == null)
|
||||
throw new ArgumentNullException("control");
|
||||
|
||||
if (Configuration.RunningOnWindows) return new WinGLControl(mode, control);
|
||||
else if (Configuration.RunningOnX11) return new X11GLControl(mode, control);
|
||||
else if (Configuration.RunningOnMacOS) return new CarbonGLControl(mode, control);
|
||||
|
|
Loading…
Reference in a new issue