From 9c214032b950f1e7c3202581a278ffe9eb0bb676 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Tue, 15 Jan 2008 12:47:51 +0000 Subject: [PATCH] Added some IGLContextInternal explicit implementations --- Source/OpenTK/Platform/X11/X11GLContext.cs | 64 +++++++++++++--------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/Source/OpenTK/Platform/X11/X11GLContext.cs b/Source/OpenTK/Platform/X11/X11GLContext.cs index 0b5fa3de..4ebf9d25 100644 --- a/Source/OpenTK/Platform/X11/X11GLContext.cs +++ b/Source/OpenTK/Platform/X11/X11GLContext.cs @@ -18,7 +18,7 @@ namespace OpenTK.Platform.X11 /// Provides methods to create and control an opengl context on the X11 platform. /// This class supports OpenTK, and is not intended for use by OpenTK programs. /// - internal sealed class X11GLContext : IGLContext, IGLContextCreationHack + internal sealed class X11GLContext : IGLContext, IGLContextInternal, IGLContextCreationHack { private IntPtr context; private DisplayMode mode; @@ -112,16 +112,6 @@ namespace OpenTK.Platform.X11 #region --- IGLContext Members --- - #region public IntPtr Context - - public IntPtr Context - { - get { return context; } - private set { context = value; } - } - - #endregion - #region public DisplayMode Mode public DisplayMode Mode @@ -138,12 +128,6 @@ namespace OpenTK.Platform.X11 #endregion - #region public IWindowInfo Info - - public IWindowInfo Info { get { return windowInfo; } } - - #endregion - public void CreateContext() { this.CreateContext(true, null); @@ -163,14 +147,14 @@ namespace OpenTK.Platform.X11 Debug.WriteLine("Creating opengl context."); Debug.Indent(); - IntPtr shareHandle = shareContext != null ? (shareContext as X11GLContext).Context: IntPtr.Zero; + ContextHandle shareHandle = shareContext != null ? (shareContext as IGLContextInternal).Context : (ContextHandle)IntPtr.Zero; Debug.Write(direct ? "Context is direct, " : "Context is indirect, "); - Debug.WriteLine(shareHandle == IntPtr.Zero ? "not shared." : + Debug.WriteLine(shareHandle.Handle == IntPtr.Zero ? "not shared." : String.Format("shared with ({0}).", shareHandle)); // Try to call Glx.CreateContext with the specified parameters. - context = Glx.CreateContext(windowInfo.Display, visual, shareHandle, direct); + context = Glx.CreateContext(windowInfo.Display, visual, shareHandle.Handle, direct); // Context creation succeeded, return. if (context != IntPtr.Zero) @@ -246,17 +230,14 @@ namespace OpenTK.Platform.X11 #endregion + #region public bool IsCurrent + public bool IsCurrent { - //return GetCurrentContext() == context; - get { throw new NotImplementedException(); } + get { return Glx.GetCurrentContext() == this.context; } } - public IntPtr GetCurrentContext() - { - //return Glx.GetCurrentContext(); - throw new NotImplementedException(); - } + #endregion public event DestroyEvent Destroy; @@ -298,6 +279,35 @@ namespace OpenTK.Platform.X11 #endregion + #region --- IGLContextInternal Members --- + + #region IntPtr IGLContextInternal.Context + + ContextHandle IGLContextInternal.Context + { + get { return context; } + /*private set { context = value; }*/ + } + + #endregion + + #region IWindowInfo IGLContextInternal.Info + + IWindowInfo IGLContextInternal.Info { get { return windowInfo; } } + + #endregion + + #region ContextHandle IGLContextInternal.GetCurrentContext() + + ContextHandle IGLContextInternal.GetCurrentContext() + { + return (ContextHandle)Glx.GetCurrentContext(); + } + + #endregion + + #endregion + #region --- IDisposable Members --- public void Dispose()