diff --git a/Source/OpenTK/Platform/Windows/WinGLContext.cs b/Source/OpenTK/Platform/Windows/WinGLContext.cs index f4f80762..de2cb30e 100644 --- a/Source/OpenTK/Platform/Windows/WinGLContext.cs +++ b/Source/OpenTK/Platform/Windows/WinGLContext.cs @@ -90,6 +90,17 @@ namespace OpenTK.Platform.Windows } } + public WinGLContext(IWindowInfo window) + { + if (window == null) throw new ArgumentNullException("window"); + + renderContext = Wgl.GetCurrentContext(); + if (renderContext == IntPtr.Zero) + throw new InvalidOperationException("No OpenGL context is current in the calling thread."); + + currentWindow = (WinWindowInfo)window; + } + #endregion #region --- IGraphicsContext Members --- diff --git a/Source/OpenTK/Platform/X11/X11GLContext.cs b/Source/OpenTK/Platform/X11/X11GLContext.cs index f2cc83a7..8873e98f 100644 --- a/Source/OpenTK/Platform/X11/X11GLContext.cs +++ b/Source/OpenTK/Platform/X11/X11GLContext.cs @@ -39,7 +39,7 @@ namespace OpenTK.Platform.X11 GraphicsContext.GetCurrentContext = X11GLContext.GetCurrentContext; } - internal X11GLContext(GraphicsMode mode, IWindowInfo info, IGraphicsContext shared, bool directRendering) + public X11GLContext(GraphicsMode mode, IWindowInfo info, IGraphicsContext shared, bool directRendering) { //if (mode == null) mode = GraphicsMode.Default; if (info == null) throw new ArgumentNullException("info", "Should point to a valid window."); @@ -52,6 +52,17 @@ namespace OpenTK.Platform.X11 CreateContext(shared, directRendering, currentWindow); } + public X11GLContext(IWindowInfo window) + { + if (window == null) throw new ArgumentNullException("window"); + + //renderContext = Glx.GetCurrentContext(); + //if (renderContext == IntPtr.Zero) + // throw new InvalidOperationException("No OpenGL context is current in the calling thread."); + + //currentWindow = window; + } + #endregion #region --- Private Methods ---