* 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
17feb8d6d0
commit
ac404e35fb
2 changed files with 10 additions and 2 deletions
|
@ -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