31641Fermer31643
WarptenLe 20/06/2017 à 14:33
            GL.DebugMessageCallback((DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr messagePtr, IntPtr errorParam) => {
                var oldForegroundColor = Console.ForegroundColor;

                var message = new string((sbyte*)messagePtr, 0, length, Encoding.ASCII);

                switch (severity)
                {
                    case DebugSeverity.DebugSeverityNotification:
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        break;
                    case DebugSeverity.DebugSeverityHigh:
                        Console.ForegroundColor = ConsoleColor.Red;
                        break;
                    case DebugSeverity.DebugSeverityMedium:
                        Console.ForegroundColor = ConsoleColor.Blue;
                        break;
                    case DebugSeverity.DebugSeverityLow:
                        Console.ForegroundColor = ConsoleColor.Green;
                        break;
                }

                Console.WriteLine(message);
                Console.ForegroundColor = oldForegroundColor;
            }, IntPtr.Zero);