From 5b9991cba322578b60127f017d6fee08ed110ab8 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Thu, 31 Jan 2008 14:39:54 +0000 Subject: [PATCH] Moved and renamed OpenTK.GLContext to OpenTK.Graphics.GraphicsContext. --- Source/Examples/Tests/S01_Call_Performance.cs | 4 +-- Source/Examples/WinForms/W03_Extensions.cs | 4 +-- Source/OpenTK/Exceptions.cs | 2 +- Source/OpenTK/GLControl.cs | 14 +++++----- Source/OpenTK/GameWindow.cs | 2 +- Source/OpenTK/Graphics/GraphicsContext.cs | 26 +++++++++---------- Source/OpenTK/OpenGL/GLHelper.cs | 4 +-- Source/OpenTK/Platform/DummyGLContext.cs | 4 +-- .../OpenTK/Platform/Windows/WinGLContext.cs | 8 +++--- Source/OpenTK/Platform/Windows/WinGLNative.cs | 2 +- Source/OpenTK/Platform/X11/X11GLContext.cs | 8 +++--- Source/OpenTK/Platform/X11/X11GLNative.cs | 4 +-- 12 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Source/Examples/Tests/S01_Call_Performance.cs b/Source/Examples/Tests/S01_Call_Performance.cs index 8b5c7143..ebfb8145 100644 --- a/Source/Examples/Tests/S01_Call_Performance.cs +++ b/Source/Examples/Tests/S01_Call_Performance.cs @@ -20,7 +20,7 @@ namespace Examples.Tests { public class S01_Call_Performance : IExample { - GLContext context; + GraphicsContext context; const int num_calls = 1000000; float[] v = new float[] { 0.0f, 0.0f }; public static int dummy_variable = 0; @@ -29,7 +29,7 @@ namespace Examples.Tests { using (Form f = new Form()) { - context = new GLContext(new OpenTK.DisplayMode(), new OpenTK.Platform.WindowInfo(f)); + context = new GraphicsContext(new OpenTK.DisplayMode(), new OpenTK.Platform.WindowInfo(f)); context.CreateContext(); Trace.WriteLine(String.Format("Number of calls: {0}", num_calls)); diff --git a/Source/Examples/WinForms/W03_Extensions.cs b/Source/Examples/WinForms/W03_Extensions.cs index 7f5a043b..51025780 100644 --- a/Source/Examples/WinForms/W03_Extensions.cs +++ b/Source/Examples/WinForms/W03_Extensions.cs @@ -25,7 +25,7 @@ namespace Examples.WinForms public partial class W03_Extensions : Form { //GLControl glControl = new GLControl(); - GLContext context; + GraphicsContext context; Type glClass; Type delegatesClass; Type importsClass; @@ -48,7 +48,7 @@ namespace Examples.WinForms { Application.Idle -= StartAsync; - context = new GLContext(new DisplayMode(), new OpenTK.Platform.WindowInfo(this)); + context = new GraphicsContext(new DisplayMode(), new OpenTK.Platform.WindowInfo(this)); context.CreateContext(); //while (!glControl.Created) diff --git a/Source/OpenTK/Exceptions.cs b/Source/OpenTK/Exceptions.cs index 4303caa8..c95bda5e 100644 --- a/Source/OpenTK/Exceptions.cs +++ b/Source/OpenTK/Exceptions.cs @@ -12,7 +12,7 @@ namespace OpenTK #region public class ContextExistsException : ApplicationException /// - /// This exception is thrown when a GLContext property cannot be changed after creation. + /// This exception is thrown when a GraphicsContext property cannot be changed after creation. /// public class ContextExistsException : ApplicationException { diff --git a/Source/OpenTK/GLControl.cs b/Source/OpenTK/GLControl.cs index cd022c42..703856bf 100644 --- a/Source/OpenTK/GLControl.cs +++ b/Source/OpenTK/GLControl.cs @@ -90,7 +90,7 @@ namespace OpenTK #region public IGraphicsContext Context /// - /// Gets an interface to the underlying GLContext used by this GLControl. + /// Gets an interface to the underlying GraphicsContext used by this GLControl. /// [Browsable(false)] public IGraphicsContext Context @@ -145,10 +145,10 @@ namespace OpenTK // TODO: Remove for 0.3.15 /// - /// Gets the DisplayMode of the GLContext attached to this GLControl. + /// Gets the DisplayMode of the GraphicsContext attached to this GLControl. /// /// - /// You cannot change the DisplayMode of an existing GLContext. + /// You cannot change the DisplayMode of an existing GraphicsContext. /// public DisplayMode Mode { @@ -189,7 +189,7 @@ namespace OpenTK #region public void CreateContext() /// - /// Creates a GLContext and attaches it to this GLControl. + /// Creates a GraphicsContext and attaches it to this GLControl. /// public void CreateContext() { @@ -203,7 +203,7 @@ namespace OpenTK // have a different colordepth from the parent. To combat this, we do not set a // specific depth for the DisplayMode - we let the driver select one instead. //display_mode.ColorFormat = new ColorMode(0); - context = new GLContext(display_mode, info); + context = new GraphicsContext(display_mode, info); idle = new PlatformIdle(info); } else @@ -218,9 +218,9 @@ namespace OpenTK #region public void DestroyContext() /// - /// Destroys the GLContext attached to this GLControl. + /// Destroys the GraphicsContext attached to this GLControl. /// - /// Occurs when no GLContext is attached. + /// Occurs when no GraphicsContext is attached. public void DestroyContext() { Context.Dispose(); diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index 1e1f90ad..20865f1b 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -128,7 +128,7 @@ namespace OpenTK glWindow.Destroy += glWindow_Destroy; - // TODO: GLContext is created inside this call. + // TODO: GraphicsContext is created inside this call. glWindow.CreateWindow(width, height, format, out glContext); this.Title = title; diff --git a/Source/OpenTK/Graphics/GraphicsContext.cs b/Source/OpenTK/Graphics/GraphicsContext.cs index 8189d397..5181d9c6 100644 --- a/Source/OpenTK/Graphics/GraphicsContext.cs +++ b/Source/OpenTK/Graphics/GraphicsContext.cs @@ -15,7 +15,7 @@ namespace OpenTK.Graphics /// /// Represents and provides methods to manipulate an OpenGL render context. /// - public sealed class GLContext : IGraphicsContext, IGLContextInternal, IGLContextCreationHack + public sealed class GraphicsContext : IGraphicsContext, IGLContextInternal, IGLContextCreationHack { IGraphicsContext implementation; // The actual render context implementation for the underlying platform. List dispose_queue = new List(); @@ -26,14 +26,14 @@ namespace OpenTK.Graphics static Dictionary available_contexts = new Dictionary(); // Contains all available OpenGL contexts. - #region public GLContext(DisplayMode mode, IWindowInfo window) + #region public GraphicsContext(DisplayMode mode, IWindowInfo window) /// - /// Constructs a new GLContext with the specified DisplayMode, and bound to the specified IWindowInfo. + /// Constructs a new GraphicsContext with the specified DisplayMode, and bound to the specified IWindowInfo. /// /// /// - public GLContext(DisplayMode mode, IWindowInfo window) + public GraphicsContext(DisplayMode mode, IWindowInfo window) { //if (available_contexts.Count == 0) // available_contexts.Add(IntPtr.Zero, new WeakReference(null)); @@ -58,14 +58,14 @@ namespace OpenTK.Graphics (this as IGLContextCreationHack).SetWindowHandle(window.Handle); (this as IGLContextCreationHack).SelectDisplayMode(mode, window); - if (GLContext.ShareContexts) + if (GraphicsContext.ShareContexts) { lock (context_lock) { // A small hack to create a shared context with the first available context. - foreach (WeakReference r in GLContext.available_contexts.Values) + foreach (WeakReference r in GraphicsContext.available_contexts.Values) { - this.CreateContext(true, (GLContext)r.Target); + this.CreateContext(true, (GraphicsContext)r.Target); return; } } @@ -102,15 +102,15 @@ namespace OpenTK.Graphics /// /// Gets or sets the current GraphicsContext in the calling thread. /// - public static GLContext CurrentContext + public static GraphicsContext CurrentContext { get { if (available_contexts.Count > 0) - return (GLContext)available_contexts[GetCurrentContext()].Target; - //return (GLContext)available_contexts[((IGLContextInternal)available_contexts[IntPtr.Zero].Target).GetCurrentContext()].Target; + return (GraphicsContext)available_contexts[GetCurrentContext()].Target; + //return (GraphicsContext)available_contexts[((IGLContextInternal)available_contexts[IntPtr.Zero].Target).GetCurrentContext()].Target; return null; - //return (GLContext)available_contexts[StaticGetCurrentContext().ToInt64()].Target; + //return (GraphicsContext)available_contexts[StaticGetCurrentContext().ToInt64()].Target; } set { @@ -334,7 +334,7 @@ namespace OpenTK.Graphics #region --- IDisposable Members --- /// - /// Disposes of the GLContext. + /// Disposes of the GraphicsContext. /// public void Dispose() { @@ -355,7 +355,7 @@ namespace OpenTK.Graphics } } - ~GLContext() + ~GraphicsContext() { this.Dispose(false); } diff --git a/Source/OpenTK/OpenGL/GLHelper.cs b/Source/OpenTK/OpenGL/GLHelper.cs index e676f47c..0fc5f945 100644 --- a/Source/OpenTK/OpenGL/GLHelper.cs +++ b/Source/OpenTK/OpenGL/GLHelper.cs @@ -192,8 +192,8 @@ namespace OpenTK.OpenGL /// public static void LoadAll() { - //TODO: Route GameWindow context creation through GLContext. - //if (GLContext.CurrentContext == null) + //TODO: Route GameWindow context creation through GraphicsContext. + //if (GraphicsContext.CurrentContext == null) // throw new InvalidOperationException("You must create an OpenGL context before using the GL class."); OpenTK.Platform.Utilities.LoadExtensions(glClass); diff --git a/Source/OpenTK/Platform/DummyGLContext.cs b/Source/OpenTK/Platform/DummyGLContext.cs index c8a457c8..ec8f2685 100644 --- a/Source/OpenTK/Platform/DummyGLContext.cs +++ b/Source/OpenTK/Platform/DummyGLContext.cs @@ -46,12 +46,12 @@ namespace OpenTK.Platform public void RegisterForDisposal(IDisposable resource) { - throw new NotImplementedException("Use the general GLContext class instead."); + throw new NotImplementedException("Use the general GraphicsContext class instead."); } public void DisposeResources() { - throw new NotImplementedException("Use the general GLContext class instead."); + throw new NotImplementedException("Use the general GraphicsContext class instead."); } public IntPtr GetAddress(string function) { return IntPtr.Zero; } diff --git a/Source/OpenTK/Platform/Windows/WinGLContext.cs b/Source/OpenTK/Platform/Windows/WinGLContext.cs index 3568f83e..17881e1d 100644 --- a/Source/OpenTK/Platform/Windows/WinGLContext.cs +++ b/Source/OpenTK/Platform/Windows/WinGLContext.cs @@ -42,8 +42,8 @@ namespace OpenTK.Platform.Windows static WinGLContext() { // Set the GetCurrentContext implementation. - if (GLContext.GetCurrentContext == null) - GLContext.GetCurrentContext = WinGLContext.GetCurrentContext; + if (GraphicsContext.GetCurrentContext == null) + GraphicsContext.GetCurrentContext = WinGLContext.GetCurrentContext; } public WinGLContext() @@ -218,7 +218,7 @@ namespace OpenTK.Platform.Windows void IGLContextInternal.RegisterForDisposal(IDisposable resource) { - throw new NotSupportedException("Use OpenTK.GLContext instead."); + throw new NotSupportedException("Use OpenTK.GraphicsContext instead."); } #endregion @@ -227,7 +227,7 @@ namespace OpenTK.Platform.Windows void IGLContextInternal.DisposeResources() { - throw new NotSupportedException("Use OpenTK.GLContext instead."); + throw new NotSupportedException("Use OpenTK.GraphicsContext instead."); } #endregion diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index 2d1029e6..098fbc00 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -367,7 +367,7 @@ namespace OpenTK.Platform.Windows Functions.SetWindowPos(this.Handle, WindowPlacementOptions.TOP, Left, Top, cp.Width, cp.Height, SetWindowPosFlags.SHOWWINDOW); - //context = new GLContext(mode, window); + //context = new GraphicsContext(mode, window); //context.CreateContext(); context = new WinGLContext(); diff --git a/Source/OpenTK/Platform/X11/X11GLContext.cs b/Source/OpenTK/Platform/X11/X11GLContext.cs index 69227506..7e9cc702 100644 --- a/Source/OpenTK/Platform/X11/X11GLContext.cs +++ b/Source/OpenTK/Platform/X11/X11GLContext.cs @@ -35,8 +35,8 @@ namespace OpenTK.Platform.X11 static X11GLContext() { // Set the GetCurrentContext implementation. - if (GLContext.GetCurrentContext == null) - GLContext.GetCurrentContext = X11GLContext.GetCurrentContext; + if (GraphicsContext.GetCurrentContext == null) + GraphicsContext.GetCurrentContext = X11GLContext.GetCurrentContext; } /// @@ -302,12 +302,12 @@ namespace OpenTK.Platform.X11 public void RegisterForDisposal(IDisposable resource) { - throw new NotSupportedException("Use OpenTK.GLContext instead."); + throw new NotSupportedException("Use OpenTK.GraphicsContext instead."); } public void DisposeResources() { - throw new NotSupportedException("Use OpenTK.GLContext instead."); + throw new NotSupportedException("Use OpenTK.GraphicsContext instead."); } public IEnumerable GetDisplayModes() diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index ab6ec552..c81be85a 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -405,8 +405,8 @@ namespace OpenTK.Platform.X11 glContext = new X11GLContext(); (glContext as IGLContextCreationHack).SelectDisplayMode(mode, window); if (glContext == null) - throw new ApplicationException("Could not create GLContext"); - Debug.Print("Created GLContext"); + throw new ApplicationException("Could not create GraphicsContext"); + Debug.Print("Created GraphicsContext"); window.VisualInfo = ((X11.WindowInfo)((IGLContextInternal)glContext).Info).VisualInfo; //window.VisualInfo = Marshal.PtrToStructure(Glx.ChooseVisual(window.Display, window.Screen,