Added Assert function for checking whether a GraphicsContext is exists in the calling thread.

This commit is contained in:
the_fiddler 2008-11-20 22:25:28 +00:00
parent b61bf2e77d
commit 73de884ee7

View file

@ -93,9 +93,12 @@ namespace OpenTK.Graphics
#endregion #endregion
#region private GraphicsContext()
private GraphicsContext() private GraphicsContext()
{ { }
}
#endregion
/// <summary> /// <summary>
/// Attempts to create a GraphicsContext object from an existing OpenGL context. /// Attempts to create a GraphicsContext object from an existing OpenGL context.
@ -216,6 +219,19 @@ namespace OpenTK.Graphics
#region public static AvailableDisplayFormats #region public static AvailableDisplayFormats
#endregion
#region public static void Assert()
/// <summary>
/// Checks if a GraphicsContext exists in the calling thread and throws a GraphicsContextException if it doesn't.
/// </summary>
public static void Assert()
{
if (GraphicsContext.CurrentContext == null)
throw new GraphicsContextException();
}
#endregion #endregion
#endregion #endregion
@ -301,7 +317,7 @@ namespace OpenTK.Graphics
#endregion #endregion
#region --- IGLContextInternal Members --- #region --- IGraphicsContextInternal Members ---
#region void LoadAll() #region void LoadAll()