Skip to content

Commit

Permalink
Fixed DebugMessageCallback collection
Browse files Browse the repository at this point in the history
  • Loading branch information
Tornado-Technology committed Jul 14, 2024
1 parent 65168e7 commit 8616984
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Hypercube.Client/Graphics/Rendering/Renderer.OpenGL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ public sealed partial class Renderer
{
private const int SwapInterval = 1;

/// <summary>
/// This is where we store the callback
/// because otherwise GC will collect it.
/// </summary>
private DebugProc? _debugProc;

private void InitOpenGL()
{
GL.LoadBindings(_bindingsContext);
Expand All @@ -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);
Expand Down

0 comments on commit 8616984

Please sign in to comment.