diff --git a/Source/OpenTK/Graphics/GL/GLHelper.cs b/Source/OpenTK/Graphics/GL/GLHelper.cs index 9b7edd0b..9da1a95a 100644 --- a/Source/OpenTK/Graphics/GL/GLHelper.cs +++ b/Source/OpenTK/Graphics/GL/GLHelper.cs @@ -913,6 +913,11 @@ namespace OpenTK.Graphics } } + public static void Uniform4(int location, Color4 color) + { + unsafe { GL.Uniform4(location, 4, &color.R); } + } + #endregion #endregion diff --git a/Source/OpenTK/Graphics/GraphicsContext.cs b/Source/OpenTK/Graphics/GraphicsContext.cs index 49891f3b..5797db2a 100644 --- a/Source/OpenTK/Graphics/GraphicsContext.cs +++ b/Source/OpenTK/Graphics/GraphicsContext.cs @@ -281,10 +281,7 @@ namespace OpenTK.Graphics } sb.Remove(sb.Length - 2, 2); // Remove the last comma - Debug.Print(String.Format("OpenGL error(s) detected: {0}", sb.ToString())); - Debug.Indent(); - Debug.WriteLine(new StackTrace(true).ToString()); - Debug.Unindent(); + throw new OpenGLErrorException(sb.ToString()); } } } @@ -533,4 +530,18 @@ namespace OpenTK.Graphics } #endregion + + #region class GraphicsErrorException : GraphicsException + + // This is private by design. These exceptions are only thrown in debug builds of + // OpenTK and the user should *not* handle them. + // If some specific OpenGL error is generated by design, the user should + // turn off automatic error checking for that portion of the code, using + // 'GraphicsContext.ErrorChecking = false'. + class OpenGLErrorException : GraphicsException + { + public OpenGLErrorException(string message) : base(message) { } + } + + #endregion }