diff --git a/Source/OpenTK/GLControl.cs b/Source/OpenTK/GLControl.cs
index 5314e4dc..83c9747e 100644
--- a/Source/OpenTK/GLControl.cs
+++ b/Source/OpenTK/GLControl.cs
@@ -53,13 +53,13 @@ namespace OpenTK
/// The OpenTK.Graphics.GraphicsMode of the control.
public GLControl(GraphicsMode mode)
{
- InitializeComponent();
-
- this.SetStyle(ControlStyles.Opaque, true);
- this.SetStyle(ControlStyles.UserPaint, true);
- this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+ SetStyle(ControlStyles.Opaque, true);
+ SetStyle(ControlStyles.UserPaint, true);
+ SetStyle(ControlStyles.AllPaintingInWmPaint, true);
DoubleBuffered = false;
+ InitializeComponent();
+
this.format = mode;
// On Windows, you first need to create the window, then set the pixel format.
@@ -69,10 +69,12 @@ namespace OpenTK
// it would be better to decouple selection from context creation, which will allow us
// to clean up this hacky code. The best option is to do this along with multisampling
// support.
- if (Configuration.RunningOnWindows)
- implementation = new OpenTK.Platform.Windows.WinGLControl(mode, this);
+ if (DesignMode)
+ implementation = new Platform.Dummy.DummyGLControl();
+ else if (Configuration.RunningOnWindows)
+ implementation = new Platform.Windows.WinGLControl(mode, this);
else if (Configuration.RunningOnX11)
- implementation = new OpenTK.Platform.X11.X11GLControl(mode, this);
+ implementation = new Platform.X11.X11GLControl(mode, this);
else if (Configuration.RunningOnOSX)
throw new PlatformNotSupportedException("Refer to http://www.opentk.com for more information.");
@@ -89,10 +91,7 @@ namespace OpenTK
{
base.OnHandleCreated(e);
- if (DesignMode)
- this.Context = new DummyGLContext(null);
- else
- this.Context = implementation.CreateContext();
+ this.Context = implementation.CreateContext();
this.window_info = implementation.WindowInfo;
this.MakeCurrent();
@@ -193,7 +192,7 @@ namespace OpenTK
}
}
else
- context = new DummyGLContext(format);
+ context = new Platform.Dummy.DummyGLContext(format);
this.MakeCurrent();
(context as IGraphicsContextInternal).LoadAll();
diff --git a/Source/OpenTK/Graphics/GraphicsContext.cs b/Source/OpenTK/Graphics/GraphicsContext.cs
index da16582b..1d11890d 100644
--- a/Source/OpenTK/Graphics/GraphicsContext.cs
+++ b/Source/OpenTK/Graphics/GraphicsContext.cs
@@ -71,11 +71,11 @@ namespace OpenTK.Graphics
}
if (designMode)
- implementation = new OpenTK.Platform.DummyGLContext(mode);
+ implementation = new Platform.Dummy.DummyGLContext(mode);
else if (Configuration.RunningOnWindows)
- implementation = new OpenTK.Platform.Windows.WinGLContext(mode, window, shareContext);
+ implementation = new Platform.Windows.WinGLContext(mode, window, shareContext);
else if (Configuration.RunningOnX11)
- implementation = new OpenTK.Platform.X11.X11GLContext(mode, window, shareContext, DirectRendering);
+ implementation = new Platform.X11.X11GLContext(mode, window, shareContext, DirectRendering);
else
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
diff --git a/Source/OpenTK/Platform/DummyGLContext.cs b/Source/OpenTK/Platform/Dummy/DummyGLContext.cs
similarity index 95%
rename from Source/OpenTK/Platform/DummyGLContext.cs
rename to Source/OpenTK/Platform/Dummy/DummyGLContext.cs
index 64d8e9bb..7eb26728 100644
--- a/Source/OpenTK/Platform/DummyGLContext.cs
+++ b/Source/OpenTK/Platform/Dummy/DummyGLContext.cs
@@ -11,7 +11,7 @@ using System.Collections.Generic;
using System.Text;
using OpenTK.Graphics;
-namespace OpenTK.Platform
+namespace OpenTK.Platform.Dummy
{
///
/// An empty IGraphicsContext implementation to be used inside the Visual Studio designer.
diff --git a/Source/OpenTK/Platform/Dummy/DummyGLControl.cs b/Source/OpenTK/Platform/Dummy/DummyGLControl.cs
new file mode 100644
index 00000000..f6fb7d19
--- /dev/null
+++ b/Source/OpenTK/Platform/Dummy/DummyGLControl.cs
@@ -0,0 +1,26 @@
+using OpenTK.Graphics;
+
+namespace OpenTK.Platform.Dummy
+{
+ class DummyGLControl : IGLControl
+ {
+ #region IGLControl Members
+
+ public OpenTK.Graphics.GraphicsContext CreateContext()
+ {
+ return new GraphicsContext(null, null);
+ }
+
+ public bool IsIdle
+ {
+ get { return false; }
+ }
+
+ public IWindowInfo WindowInfo
+ {
+ get { return new DummyWindowInfo(); }
+ }
+
+ #endregion
+ }
+}
diff --git a/Source/OpenTK/Platform/Dummy/DummyWindowInfo.cs b/Source/OpenTK/Platform/Dummy/DummyWindowInfo.cs
new file mode 100644
index 00000000..da66ddb3
--- /dev/null
+++ b/Source/OpenTK/Platform/Dummy/DummyWindowInfo.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenTK.Platform.Dummy
+{
+ class DummyWindowInfo : IWindowInfo
+ {
+ #region IDisposable Members
+
+ public void Dispose()
+ {
+ }
+
+ #endregion
+ }
+}