GL error logging
This commit is contained in:
committed by
Chris Forbes
parent
0dddf12831
commit
4ca4d7b5dd
13
OpenRA.Gl/GraphicsDevice.cs
Normal file → Executable file
13
OpenRA.Gl/GraphicsDevice.cs
Normal file → Executable file
@@ -31,11 +31,22 @@ namespace OpenRA.GlRenderer
|
|||||||
|
|
||||||
public Size WindowSize { get { return windowSize; } }
|
public Size WindowSize { get { return windowSize; } }
|
||||||
|
|
||||||
|
public enum GlError
|
||||||
|
{
|
||||||
|
GL_NO_ERROR = Gl.GL_NO_ERROR,
|
||||||
|
GL_INVALID_ENUM = Gl.GL_INVALID_ENUM,
|
||||||
|
GL_INVALID_VALUE = Gl.GL_INVALID_VALUE,
|
||||||
|
GL_STACK_OVERFLOW = Gl.GL_STACK_OVERFLOW,
|
||||||
|
GL_STACK_UNDERFLOW = Gl.GL_STACK_UNDERFLOW,
|
||||||
|
GL_OUT_OF_MEMORY = Gl.GL_OUT_OF_MEMORY,
|
||||||
|
GL_TABLE_TOO_LARGE = Gl.GL_TABLE_TOO_LARGE,
|
||||||
|
}
|
||||||
|
|
||||||
internal static void CheckGlError()
|
internal static void CheckGlError()
|
||||||
{
|
{
|
||||||
var n = Gl.glGetError();
|
var n = Gl.glGetError();
|
||||||
if (n != Gl.GL_NO_ERROR)
|
if (n != Gl.GL_NO_ERROR)
|
||||||
throw new InvalidOperationException("GL Error");
|
throw new InvalidOperationException("GL Error: " + ((GlError)n).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public GraphicsDevice(int width, int height, WindowMode window, bool vsync)
|
public GraphicsDevice(int width, int height, WindowMode window, bool vsync)
|
||||||
|
|||||||
Reference in New Issue
Block a user