Skip to content

Commit

Permalink
hello_xr: Adapt debug callback, to fix OpenGL on MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
rpavlik committed Oct 18, 2023
1 parent 2dc9060 commit 32880b2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/tests/hello_xr/graphicsplugin_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
// SPDX-License-Identifier: Apache-2.0

#include "pch.h"

#ifdef __MINGW32__
#define GL_ATTRIBUTE __attribute__((stdcall))
#else
#define GL_ATTRIBUTE
#endif
#include "common.h"
#include "geometry.h"
#include "graphicsplugin.h"
Expand Down Expand Up @@ -149,17 +155,15 @@ struct OpenGLGraphicsPlugin : public IGraphicsPlugin {

#if !defined(XR_USE_PLATFORM_MACOS)
glEnable(GL_DEBUG_OUTPUT);
glDebugMessageCallback(
[](GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message,
const void* userParam) {
((OpenGLGraphicsPlugin*)userParam)->DebugMessageCallback(source, type, id, severity, length, message);
},
this);
glDebugMessageCallback((GLDEBUGPROC)&OpenGLGraphicsPlugin::DebugMessageCallbackTrampoline, this);
#endif // !defined(XR_USE_PLATFORM_MACOS)

InitializeResources();
}

static void GL_ATTRIBUTE DebugMessageCallbackTrampoline(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
const GLchar* message, const void* userParam) {
((OpenGLGraphicsPlugin*)userParam)->DebugMessageCallback(source, type, id, severity, length, message);
}
void InitializeResources() {
glGenFramebuffers(1, &m_swapchainFramebuffer);

Expand Down

0 comments on commit 32880b2

Please sign in to comment.