From da6682711a69bbc8686e73201149f7593c1042c6 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 20 Jun 2017 15:45:49 +0200 Subject: [PATCH] Removed obsolete CreateDummyContext functions and added constructor constructor comments which explain how to create a dummy context. --- src/OpenTK/Graphics/GraphicsContext.cs | 53 +++++----------------------------- 1 file changed, 8 insertions(+), 45 deletions(-) diff --git a/src/OpenTK/Graphics/GraphicsContext.cs b/src/OpenTK/Graphics/GraphicsContext.cs index a2104e3..cea9a82 100644 --- a/src/OpenTK/Graphics/GraphicsContext.cs +++ b/src/OpenTK/Graphics/GraphicsContext.cs @@ -6,7 +6,7 @@ // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights to +// in the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: @@ -40,7 +40,7 @@ namespace OpenTK.Graphics public sealed class GraphicsContext : IGraphicsContext, IGraphicsContextInternal { /// - /// Used to retrive function pointers by name. + /// Used to retrive function pointers by name. /// /// The function name. /// A function pointer to , or IntPtr.Zero @@ -67,7 +67,7 @@ namespace OpenTK.Graphics static bool share_contexts = true; static bool direct_rendering = true; - readonly static object SyncRoot = new object(); + readonly static object SyncRoot = new object(); // Maps OS-specific context handles to GraphicsContext instances. readonly static Dictionary available_contexts = new Dictionary(); @@ -102,7 +102,8 @@ namespace OpenTK.Graphics } /// - /// Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the specified window. + /// Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the specified window. A dummy context will be created if both + /// the handle and the window are null. /// /// The OpenTK.Graphics.GraphicsMode of the GraphicsContext. /// The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to. @@ -252,7 +253,8 @@ namespace OpenTK.Graphics } /// - /// Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK. + /// Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK. A dummy context will be created if both + /// the handle and the window are null. /// /// The handle of the existing context. This must be a valid, unique handle that is not known to OpenTK. /// This parameter is reserved. @@ -360,45 +362,6 @@ namespace OpenTK.Graphics #region --- Static Members --- - #region public static GraphicsContext CreateDummyContext() - - /// - /// Creates a dummy GraphicsContext to allow OpenTK to work with contexts created by external libraries. - /// - /// A new, dummy GraphicsContext instance. - /// - /// Instances created by this method will not be functional. Instance methods will have no effect. - /// This method requires that a context is current on the calling thread. - /// - [Obsolete("Use GraphicsContext(ContextHandle, IWindowInfo) constructor instead")] - public static GraphicsContext CreateDummyContext() - { - ContextHandle handle = GetCurrentContext(); - if (handle == ContextHandle.Zero) - throw new InvalidOperationException("No GraphicsContext is current on the calling thread."); - - return CreateDummyContext(handle); - } - - /// - /// Creates a dummy GraphicsContext to allow OpenTK to work with contexts created by external libraries. - /// - /// The handle of a context. - /// A new, dummy GraphicsContext instance. - /// - /// Instances created by this method will not be functional. Instance methods will have no effect. - /// - [Obsolete("Use GraphicsContext(ContextHandle, IWindowInfo) constructor instead")] - public static GraphicsContext CreateDummyContext(ContextHandle handle) - { - if (handle == ContextHandle.Zero) - throw new ArgumentOutOfRangeException("handle"); - - return new GraphicsContext(handle, (IWindowInfo)null); - } - - #endregion - #region public static void Assert() /// @@ -594,7 +557,7 @@ namespace OpenTK.Graphics implementation.LoadAll(); } - + #endregion #region --- IGraphicsContextInternal Members --- -- 2.7.4