mirror of
https://github.com/NoelFB/blah.git
synced 2025-04-18 03:46:04 +08:00
Fix issue with glDebugMessageCallback not existing on macOS
This commit is contained in:
parent
20a6d9411d
commit
06ebcafcc4
@ -226,7 +226,6 @@ typedef char GLchar;
|
|||||||
|
|
||||||
// OpenGL Functions
|
// OpenGL Functions
|
||||||
#define GL_FUNCTIONS \
|
#define GL_FUNCTIONS \
|
||||||
GL_FUNC(DebugMessageCallback, void, DEBUGPROC callback, const void* userParam) \
|
|
||||||
GL_FUNC(GetString, const GLubyte*, GLenum name) \
|
GL_FUNC(GetString, const GLubyte*, GLenum name) \
|
||||||
GL_FUNC(Flush, void, void) \
|
GL_FUNC(Flush, void, void) \
|
||||||
GL_FUNC(Enable, void, GLenum mode) \
|
GL_FUNC(Enable, void, GLenum mode) \
|
||||||
@ -330,6 +329,10 @@ typedef char GLchar;
|
|||||||
GL_FUNC(UniformMatrix4x3fv, void, GLint location, GLint count, GLboolean transpose, const GLfloat* value) \
|
GL_FUNC(UniformMatrix4x3fv, void, GLint location, GLint count, GLboolean transpose, const GLfloat* value) \
|
||||||
GL_FUNC(PixelStorei, void, GLenum pname, GLint param)
|
GL_FUNC(PixelStorei, void, GLenum pname, GLint param)
|
||||||
|
|
||||||
|
// OpenGL Functions only on OpenGL >= 4.3
|
||||||
|
#define GL_FUNCTIONS_4_3 \
|
||||||
|
GL_FUNC(DebugMessageCallback, void, DEBUGPROC callback, const void* userParam)
|
||||||
|
|
||||||
// Debug Function Delegate
|
// Debug Function Delegate
|
||||||
typedef void (APIENTRY* DEBUGPROC)(GLenum source,
|
typedef void (APIENTRY* DEBUGPROC)(GLenum source,
|
||||||
GLenum type,
|
GLenum type,
|
||||||
@ -398,6 +401,9 @@ namespace Blah
|
|||||||
// GL function pointers
|
// GL function pointers
|
||||||
#define GL_FUNC(name, ret, ...) typedef ret (*name ## Func) (__VA_ARGS__); name ## Func name;
|
#define GL_FUNC(name, ret, ...) typedef ret (*name ## Func) (__VA_ARGS__); name ## Func name;
|
||||||
GL_FUNCTIONS
|
GL_FUNCTIONS
|
||||||
|
#ifndef __APPLE__
|
||||||
|
GL_FUNCTIONS_4_3
|
||||||
|
#endif
|
||||||
#undef GL_FUNC
|
#undef GL_FUNC
|
||||||
} gl;
|
} gl;
|
||||||
|
|
||||||
@ -426,7 +432,8 @@ namespace Blah
|
|||||||
MeshRef create_mesh() override;
|
MeshRef create_mesh() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// debug callback
|
// debug callback, only on OpenGL >= 4.3
|
||||||
|
#ifndef __APPLE__
|
||||||
void APIENTRY gl_message_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
|
void APIENTRY gl_message_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
|
||||||
{
|
{
|
||||||
// these are basically never useful
|
// these are basically never useful
|
||||||
@ -465,6 +472,7 @@ namespace Blah
|
|||||||
else
|
else
|
||||||
Log::info("GL (%s) %s", typeName, message);
|
Log::info("GL (%s) %s", typeName, message);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// assign attributes
|
// assign attributes
|
||||||
GLuint gl_mesh_assign_attributes(GLuint buffer, GLenum buffer_type, const VertexFormat& format, GLint divisor)
|
GLuint gl_mesh_assign_attributes(GLuint buffer, GLenum buffer_type, const VertexFormat& format, GLint divisor)
|
||||||
@ -1189,13 +1197,15 @@ namespace Blah
|
|||||||
GL_FUNCTIONS
|
GL_FUNCTIONS
|
||||||
#undef GL_FUNC
|
#undef GL_FUNC
|
||||||
|
|
||||||
// bind debug message callback
|
// bind debug message callback, only on OpenGL >= 4.3
|
||||||
|
#ifndef __APPLE__
|
||||||
if (gl.DebugMessageCallback != nullptr)
|
if (gl.DebugMessageCallback != nullptr)
|
||||||
{
|
{
|
||||||
gl.Enable(GL_DEBUG_OUTPUT);
|
gl.Enable(GL_DEBUG_OUTPUT);
|
||||||
gl.Enable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
gl.Enable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||||
gl.DebugMessageCallback(gl_message_callback, nullptr);
|
gl.DebugMessageCallback(gl_message_callback, nullptr);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// get opengl info
|
// get opengl info
|
||||||
gl.GetIntegerv(0x8CDF, &max_color_attachments);
|
gl.GetIntegerv(0x8CDF, &max_color_attachments);
|
||||||
|
Loading…
Reference in New Issue
Block a user