forked from Mirrors/openclonk
Test whether GLDEBUGPROCARB's userParam is const or not
Depending on how current your headers are, the userParam parameter to GLDEBUGPROCARB may be const, or it may not. The ARB has added the const qualifier at some point after publishing the specs. Hooray for breaking API changes.issue1247
parent
15f75f072b
commit
9bfd232ab5
|
@ -1326,6 +1326,11 @@ if(NOT USE_CONSOLE)
|
|||
${OPENGL_LIBRARIES}
|
||||
)
|
||||
include_directories(${GLEW_INCLUDE_DIR})
|
||||
# On some platforms, GLEW declares the userParam parameter of
|
||||
# GLDEBUGPROCARB as const void *, and on other platforms, it's void *.
|
||||
# Test which one works here.
|
||||
set(CMAKE_REQUIRED_INCLUDES "${GLEW_INCLUDE_DIR}")
|
||||
CHECK_CXX_SOURCE_COMPILES("#include <GL/glew.h>\nvoid GLAPIENTRY OpenGLDebugProc(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* message, const void* userParam) {}\nint main() { GLDEBUGPROCARB proc = &OpenGLDebugProc; }" GLDEBUGPROCARB_USERPARAM_IS_CONST)
|
||||
endif()
|
||||
if(USE_GTK)
|
||||
if(USE_GTK3)
|
||||
|
|
|
@ -163,6 +163,10 @@
|
|||
/* Define to 1 if you want to use Boost.Regex instead of <regex>. */
|
||||
#cmakedefine USE_BOOST_REGEX 1
|
||||
|
||||
/* Define to 1 if the userParam parameter to GLDEBUGPROCARB is const, as the
|
||||
spec requires. */
|
||||
#cmakedefine GLDEBUGPROCARB_USERPARAM_IS_CONST 1
|
||||
|
||||
/* Glib */
|
||||
#cmakedefine WITH_GLIB 1
|
||||
|
||||
|
|
|
@ -77,7 +77,13 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
void GLAPIENTRY OpenGLDebugProc(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* message, const void* userParam)
|
||||
#ifdef GLDEBUGPROCARB_USERPARAM_IS_CONST
|
||||
#define USERPARAM_CONST const
|
||||
#else
|
||||
#define USERPARAM_CONST
|
||||
#endif
|
||||
|
||||
void GLAPIENTRY OpenGLDebugProc(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* message, USERPARAM_CONST void* userParam)
|
||||
{
|
||||
const char *msg_source = MsgSourceToStr(source);
|
||||
const char *msg_type = MsgTypeToStr(type);
|
||||
|
@ -91,6 +97,8 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
#undef USERPARAM_CONST
|
||||
|
||||
CStdGL::CStdGL():
|
||||
pMainCtx(0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue