From 14ff4649f7a31244e23ccb7c0ae3299aa7835e4e Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Tue, 27 Feb 2018 09:00:58 -0800 Subject: [PATCH] Start trying to improve support for KHR_debug --- project/src/graphics/opengl/OpenGLBindings.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/project/src/graphics/opengl/OpenGLBindings.cpp b/project/src/graphics/opengl/OpenGLBindings.cpp index c14104b13..e47e80457 100644 --- a/project/src/graphics/opengl/OpenGLBindings.cpp +++ b/project/src/graphics/opengl/OpenGLBindings.cpp @@ -183,6 +183,13 @@ namespace lime { } + void GLAPIENTRY gl_debug_callback (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam) { + + puts (message); + + } + + void lime_gl_active_texture (int texture) { glActiveTexture (texture); @@ -1156,6 +1163,16 @@ namespace lime { if (!init) { + if (strcmp (name.__s, "KHR_debug") == 0) { + + #ifdef LIME_GLES + glDebugMessageCallbackKHR ((GLDEBUGPROCARB)gl_debug_callback, NULL); + #elif !defined(HX_MACOS) + glDebugMessageCallback ((GLDEBUGPROCARB)gl_debug_callback, NULL); + #endif + + } + init = true; kind_share (&functionKind, "function");