SND\AstrorEnales_cp ad1bc47a24 Working on all OpenGL classes and working on hardcore
error checking integration (later on this will be disabled).
2011-11-20 16:17:18 +00:00

35 lines
860 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTK.Graphics.OpenGL;
using System.Diagnostics;
using System.Reflection;
namespace ANX.Framework.Windows.GL3
{
internal static class ErrorHelper
{
public static void Check(string extraInformation = "")
{
ErrorCode code = GL.GetError();
if (code != ErrorCode.NoError)
{
string frameInfo = "";
foreach (StackFrame frame in new StackTrace().GetFrames())
{
MethodBase method = frame.GetMethod();
frameInfo += "\n\t" + "at " + method.DeclaringType + "." +
method + ":" + frame.GetFileLineNumber();
}
string message = "OpenGL Error '" + code + "' Checked at: '" +
extraInformation + "'" + frameInfo;
Console.WriteLine(message);
Debug.WriteLine(message);
}
}
}
}