diff --git a/Source/GLControl/DummyGLControl.cs b/Source/GLControl/DummyGLControl.cs index 05891b19..70501fcf 100644 --- a/Source/GLControl/DummyGLControl.cs +++ b/Source/GLControl/DummyGLControl.cs @@ -37,7 +37,7 @@ namespace OpenTK public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags) { - return new GraphicsContext(null, null); + return new DummyContext(); } public bool IsIdle @@ -51,5 +51,121 @@ namespace OpenTK } #endregion + + #region class DummyContext + + class DummyContext : IGraphicsContext, IGraphicsContextInternal + { + static int instance_count; + + readonly ContextHandle handle = new ContextHandle(new IntPtr( + System.Threading.Interlocked.Increment(ref instance_count))); + + IWindowInfo current_window; + bool is_disposed; + int swap_interval; + + #region IGraphicsContext Members + + public void SwapBuffers() + { + } + + public void MakeCurrent(IWindowInfo window) + { + current_window = window; + } + + public bool IsCurrent + { + get { return current_window != null; } + } + + public bool IsDisposed + { + get { return is_disposed; } + } + + public bool VSync + { + get + { + return SwapInterval != 0; + } + set + { + SwapInterval = value ? 1 : 0; + } + } + + public int SwapInterval + { + get + { + return swap_interval; + } + set + { + swap_interval = value; + } + } + + public void Update(IWindowInfo window) + { + } + + public GraphicsMode GraphicsMode + { + get { return GraphicsMode.Default; } + } + + public bool ErrorChecking + { + get + { + return false; + } + set + { + } + } + + public void LoadAll() + { + } + + public void Dispose() + { + is_disposed = true; + } + + #endregion + + #region IGraphicsContextInternal + + public ContextHandle Context + { + get { return handle; } + } + + public IntPtr GetAddress(IntPtr function) + { + return IntPtr.Zero; + } + + public IntPtr GetAddress(string function) + { + return IntPtr.Zero; + } + + public IGraphicsContext Implementation + { + get { return this; } + } + + #endregion + } + + #endregion } }