From 6094cfbb9fb137181a4fef45130f1697b34182e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20H=C3=B6tzinger?= Date: Thu, 22 Jul 2021 18:58:32 +0200 Subject: [PATCH] Create OpenGL context with debug flag for better error messages. (#7536) --- MonoGame.Framework/Platform/Graphics/GraphicsContext.SDL.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MonoGame.Framework/Platform/Graphics/GraphicsContext.SDL.cs b/MonoGame.Framework/Platform/Graphics/GraphicsContext.SDL.cs index f6a2756b0c4..eb9d42c9354 100644 --- a/MonoGame.Framework/Platform/Graphics/GraphicsContext.SDL.cs +++ b/MonoGame.Framework/Platform/Graphics/GraphicsContext.SDL.cs @@ -41,6 +41,10 @@ public GraphicsContext(IWindowInfo info) return; SetWindowHandle(info); +#if DEBUG + // create debug context, so we get better error messages (glDebugMessageCallback) + Sdl.GL.SetAttribute(Sdl.GL.Attribute.ContextFlags, 1); // 1 = SDL_GL_CONTEXT_DEBUG_FLAG +#endif _context = Sdl.GL.CreateContext(_winHandle); // GL entry points must be loaded after the GL context creation, otherwise some Windows drivers will return only GL 1.3 compatible functions