Initial support for external contexts.

This commit is contained in:
the_fiddler 2008-05-19 20:54:07 +00:00
parent ed3fabfde6
commit b48202324b
2 changed files with 23 additions and 1 deletions

View file

@ -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 ---

View file

@ -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 ---