diff --git a/Source/OpenTK/Graphics/GraphicsContext.cs b/Source/OpenTK/Graphics/GraphicsContext.cs
index a9f882a7..c601a736 100644
--- a/Source/OpenTK/Graphics/GraphicsContext.cs
+++ b/Source/OpenTK/Graphics/GraphicsContext.cs
@@ -18,7 +18,7 @@ namespace OpenTK.Graphics
///
/// Represents and provides methods to manipulate an OpenGL render context.
///
- public sealed class GraphicsContext : IGraphicsContext, IGraphicsContextInternal, IGLContextCreationHack
+ public sealed class GraphicsContext : IGraphicsContext, IGraphicsContextInternal
{
IGraphicsContext implementation; // The actual render context implementation for the underlying platform.
List dispose_queue = new List();
@@ -48,13 +48,17 @@ namespace OpenTK.Graphics
///
/// The OpenTK.Graphics.GraphicsMode of the GraphicsContext.
/// The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to.
- public GraphicsContext(GraphicsMode format, IWindowInfo window)
+ public GraphicsContext(GraphicsMode mode, IWindowInfo window)
{
- if (window == null) throw new ArgumentNullException("window", "Must point to a valid window.");
+ bool designMode = false;
+ if (mode == null && window == null)
+ designMode = true;
+ else if (mode == null) throw new ArgumentNullException("mode", "Must be a valid GraphicsMode.");
+ else if (window == null) throw new ArgumentNullException("window", "Must point to a valid window.");
Debug.Print("Creating GraphicsContext.");
Debug.Indent();
- Debug.Print("GraphicsMode: {0}", format);
+ Debug.Print("GraphicsMode: {0}", mode);
Debug.Print("IWindowInfo: {0}", window);
IGraphicsContext shareContext = null;
@@ -71,10 +75,12 @@ namespace OpenTK.Graphics
}
}
- if (Configuration.RunningOnWindows)
- implementation = new OpenTK.Platform.Windows.WinGLContext(format, window, shareContext);
+ if (designMode)
+ implementation = new OpenTK.Platform.DummyGLContext(mode);
+ else if (Configuration.RunningOnWindows)
+ implementation = new OpenTK.Platform.Windows.WinGLContext(mode, window, shareContext);
else if (Configuration.RunningOnX11)
- implementation = new OpenTK.Platform.X11.X11GLContext(format, window, shareContext, DirectRendering);
+ implementation = new OpenTK.Platform.X11.X11GLContext(mode, window, shareContext, DirectRendering);
else
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
@@ -175,18 +181,11 @@ namespace OpenTK.Graphics
#region --- IGraphicsContext Members ---
///
- /// Creates an OpenGL context.
- ///
- public void CreateContext()
- {
- CreateContext(true, null);
- }
-
- ///
- /// Creates an OpenGL context with a direct or indirect rendering mode. This parameter is ignored
- /// on Windows platforms (direct mode only).
+ /// Creates an OpenGL context with the specified direct/indirect rendering mode and sharing state with the
+ /// specified IGraphicsContext.
///
/// Set to true for direct rendering or false otherwise.
+ /// The source IGraphicsContext to share state from..
///
///
/// Direct rendering is the default rendering mode for OpenTK, since it can provide higher performance
@@ -197,19 +196,7 @@ namespace OpenTK.Graphics
/// indirect rendering on Windows platforms).
///
///
- public void CreateContext(bool direct)
- {
- CreateContext(direct, null);
- }
-
- ///
- /// Creates an OpenGL context with the specified direct/indirect rendering mode and sharing state with the
- /// specified IGraphicsContext.
- ///
- /// Set to true for direct rendering or false otherwise.
- /// The source IGraphicsContext to share state from..
- ///
- public void CreateContext(bool direct, IGraphicsContext source)
+ void CreateContext(bool direct, IGraphicsContext source)
{
this.Destroy += ContextDestroyed;
@@ -362,20 +349,6 @@ namespace OpenTK.Graphics
#endregion
- #region --- IGLContextCreationHack Members ---
-
- bool IGLContextCreationHack.SelectDisplayMode(DisplayMode mode, IWindowInfo info)
- {
- return (implementation as IGLContextCreationHack).SelectDisplayMode(mode, info);
- }
-
- void IGLContextCreationHack.SetWindowHandle(IntPtr handle)
- {
- (implementation as IGLContextCreationHack).SetWindowHandle(handle);
- }
-
- #endregion
-
#region --- IDisposable Members ---
///
diff --git a/Source/OpenTK/Graphics/IGraphicsContext.cs b/Source/OpenTK/Graphics/IGraphicsContext.cs
index a718c81d..d813da02 100644
--- a/Source/OpenTK/Graphics/IGraphicsContext.cs
+++ b/Source/OpenTK/Graphics/IGraphicsContext.cs
@@ -48,13 +48,6 @@ namespace OpenTK.Graphics
public delegate void DestroyEvent(T sender, EventArgs e);
- // TODO: Remove in 0.3.15
- internal interface IGLContextCreationHack
- {
- bool SelectDisplayMode(DisplayMode mode, IWindowInfo info);
- void SetWindowHandle(IntPtr handle);
- }
-
// Functions for internal use by OpenTK.
// TODO: RegisterForDisposal/DisposeResources for 0.3.15 (GC & OpenGL)
// TODO: Remove or move GetDisplayModes to another class.
@@ -63,13 +56,13 @@ namespace OpenTK.Graphics
///
public interface IGraphicsContextInternal
{
- ///
- /// Creates an OpenGL context with the specified direct/indirect rendering mode and sharing state with the
- /// specified IGraphicsContext.
- ///
- /// Set to true for direct rendering or false otherwise.
- /// The source IGraphicsContext to share state from..
- ///
+ /////
+ ///// Creates an OpenGL context with the specified direct/indirect rendering mode and sharing state with the
+ ///// specified IGraphicsContext.
+ /////
+ ///// Set to true for direct rendering or false otherwise.
+ ///// The source IGraphicsContext to share state from..
+ /////
//void CreateContext(bool direct, IGraphicsContext source);
/// Prepares the entry points for OpenGL.