From b12a88c2441215d71e28ef55129b4d2e3a8c7d4a Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Mon, 24 Mar 2008 13:25:38 +0000 Subject: [PATCH] Unique handles for different contexts (makes multiple contexts work under Visual Studio designer). --- Source/OpenTK/Platform/DummyGLContext.cs | 27 +++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Source/OpenTK/Platform/DummyGLContext.cs b/Source/OpenTK/Platform/DummyGLContext.cs index 19138de2..5e483620 100644 --- a/Source/OpenTK/Platform/DummyGLContext.cs +++ b/Source/OpenTK/Platform/DummyGLContext.cs @@ -1,6 +1,8 @@ #region --- License --- -/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos - * See license.txt for license info +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing detailed licensing details. */ #endregion @@ -19,23 +21,28 @@ namespace OpenTK.Platform { GraphicsMode format; bool vsync; - static int dummy_context_count = 0; - IntPtr context; + ContextHandle handle; + static int handle_count; #region --- Constructors --- - public DummyGLContext(GraphicsMode format) { this.format = format; context = new IntPtr(dummy_context_count++); } + public DummyGLContext(GraphicsMode format) { this.format = format; } #endregion #region --- IGraphicsContext Members --- - public IntPtr Context { get { return IntPtr.Zero; } } + public IntPtr Context { get { return (IntPtr)handle_count; } } public GraphicsMode GraphicsMode { get { return format; } } - //public void CreateContext() { } - //public void CreateContext(bool direct) { } - public void CreateContext(bool direct, IGraphicsContext source) { } + public void CreateContext(bool direct, IGraphicsContext source) + { + if (handle == null) + { + ++handle_count; + handle = new ContextHandle((IntPtr)handle_count); + } + } public void SwapBuffers() { } public void MakeCurrent(IWindowInfo info) { } @@ -76,7 +83,7 @@ namespace OpenTK.Platform ContextHandle IGraphicsContextInternal.Context { - get { return context; } + get { return handle; } } #endregion