Skip to content

Commit 2af452f

Browse files
committed
hello_xr: Fix OpenGL build on MinGW
1 parent 23b1d27 commit 2af452f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/tests/hello_xr/graphicsplugin_opengl.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#include "pch.h"
2+
3+
#ifdef __MINGW32__
4+
#define GL_ATTRIBUTE __attribute__((stdcall))
5+
#else
6+
#define GL_ATTRIBUTE
7+
#endif
28
#include "common.h"
39
#include "geometry.h"
410
#include "graphicsplugin.h"
@@ -135,16 +141,14 @@ struct OpenGLGraphicsPlugin : public IGraphicsPlugin {
135141
#endif
136142

137143
glEnable(GL_DEBUG_OUTPUT);
138-
glDebugMessageCallback(
139-
[](GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message,
140-
const void* userParam) {
141-
((OpenGLGraphicsPlugin*)userParam)->DebugMessageCallback(source, type, id, severity, length, message);
142-
},
143-
this);
144+
glDebugMessageCallback(&OpenGLGraphicsPlugin::DebugMessageCallbackTrampoline, this);
144145

145146
InitializeResources();
146147
}
147-
148+
static void GL_ATTRIBUTE DebugMessageCallbackTrampoline(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
149+
const GLchar* message, const void* userParam) {
150+
((OpenGLGraphicsPlugin*)userParam)->DebugMessageCallback(source, type, id, severity, length, message);
151+
}
148152
void InitializeResources() {
149153
glGenFramebuffers(1, &m_swapchainFramebuffer);
150154

0 commit comments

Comments
 (0)