Fixed a missing call to Debug.Unindent() during context construction.

This commit is contained in:
the_fiddler 2008-04-20 17:47:26 +00:00
parent dcce9fcf73
commit fef112ab46

View file

@ -57,38 +57,45 @@ namespace OpenTK.Graphics
else if (window == null) throw new ArgumentNullException("window", "Must point to a valid window."); else if (window == null) throw new ArgumentNullException("window", "Must point to a valid window.");
Debug.Print("Creating GraphicsContext."); Debug.Print("Creating GraphicsContext.");
Debug.Indent(); try
Debug.Print("GraphicsMode: {0}", mode);
Debug.Print("IWindowInfo: {0}", window);
IGraphicsContext shareContext = null;
if (GraphicsContext.ShareContexts)
{ {
lock (context_lock) Debug.Indent();
Debug.Print("GraphicsMode: {0}", mode);
Debug.Print("IWindowInfo: {0}", window);
IGraphicsContext shareContext = null;
if (GraphicsContext.ShareContexts)
{ {
// A small hack to create a shared context with the first available context. lock (context_lock)
foreach (WeakReference r in GraphicsContext.available_contexts.Values)
{ {
shareContext = (IGraphicsContext)r.Target; // A small hack to create a shared context with the first available context.
break; foreach (WeakReference r in GraphicsContext.available_contexts.Values)
{
shareContext = (IGraphicsContext)r.Target;
break;
}
} }
} }
if (designMode)
implementation = new OpenTK.Platform.DummyGLContext(mode);
else if (Configuration.RunningOnWindows)
implementation = new OpenTK.Platform.Windows.WinGLContext(mode, window, shareContext);
else if (Configuration.RunningOnX11)
implementation = new OpenTK.Platform.X11.X11GLContext(mode, window, shareContext, DirectRendering);
else
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
lock (context_lock)
{
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
}
//(implementation as IGraphicsContextInternal).LoadAll();
} }
finally
if (designMode)
implementation = new OpenTK.Platform.DummyGLContext(mode);
else if (Configuration.RunningOnWindows)
implementation = new OpenTK.Platform.Windows.WinGLContext(mode, window, shareContext);
else if (Configuration.RunningOnX11)
implementation = new OpenTK.Platform.X11.X11GLContext(mode, window, shareContext, DirectRendering);
else
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
lock (context_lock)
{ {
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this)); Debug.Unindent();
} }
//(implementation as IGraphicsContextInternal).LoadAll();
} }
#endregion #endregion