diff --git a/Hypercube.Client/Graphics/Rendering/Renderer.OpenGL.cs b/Hypercube.Client/Graphics/Rendering/Renderer.OpenGL.cs index 8b4a44c..930fd0f 100644 --- a/Hypercube.Client/Graphics/Rendering/Renderer.OpenGL.cs +++ b/Hypercube.Client/Graphics/Rendering/Renderer.OpenGL.cs @@ -9,6 +9,12 @@ public sealed partial class Renderer { private const int SwapInterval = 1; + /// + /// This is where we store the callback + /// because otherwise GC will collect it. + /// + private DebugProc? _debugProc; + private void InitOpenGL() { GL.LoadBindings(_bindingsContext); @@ -26,8 +32,9 @@ private void InitOpenGL() GLFW.SwapInterval(SwapInterval); _loggerOpenGL.EngineInfo($"Swap interval: {SwapInterval}"); - - //GL.DebugMessageCallback(DebugMessageCallback, IntPtr.Zero); + + _debugProc = DebugMessageCallback; + GL.DebugMessageCallback(_debugProc, IntPtr.Zero); GL.Enable(EnableCap.Blend); GL.Enable(EnableCap.DebugOutput);