mirror of
https://github.com/leozide/leocad
synced 2025-02-05 08:45:55 +01:00
Enabled GL debug messages.
This commit is contained in:
parent
7b52f7ba40
commit
49a49125c2
2 changed files with 64 additions and 1 deletions
|
@ -138,10 +138,34 @@ bool GL_ExtensionSupported(const GLubyte* Extensions, const char* Name)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
|
||||
static void APIENTRY lcDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid *userParam)
|
||||
{
|
||||
qDebug() << message;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void GL_InitializeSharedExtensions(lcGLWidget* Window)
|
||||
{
|
||||
const GLubyte* Extensions = glGetString(GL_EXTENSIONS);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
if (GL_ExtensionSupported(Extensions, "GL_KHR_debug"))
|
||||
{
|
||||
GLDEBUGMESSAGECALLBACKARBPROC DebugMessageCallback = (GLDEBUGMESSAGECALLBACKARBPROC)Window->GetExtensionAddress("glDebugMessageCallback");
|
||||
|
||||
if (DebugMessageCallback)
|
||||
{
|
||||
DebugMessageCallback((GLDEBUGPROCARB)&lcDebugCallback, NULL);
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
}
|
||||
glBegin(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (GL_ExtensionSupported(Extensions, "GL_EXT_texture_filter_anisotropic"))
|
||||
{
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &GL_MaxAnisotropy);
|
||||
|
|
|
@ -80,7 +80,40 @@ inline bool GL_HasFramebufferObjectEXT()
|
|||
#define GL_COMPARE_R_TO_TEXTURE 0x884E
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#ifndef GL_VERSION_2_0
|
||||
typedef char GLchar;
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_4_3
|
||||
#define GL_DEBUG_OUTPUT 0x92E0
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_debug_output
|
||||
#define GL_ARB_debug_output 1
|
||||
typedef void (APIENTRY *GLDEBUGPROCARB) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam);
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
|
||||
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
|
||||
#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
|
||||
#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245
|
||||
#define GL_DEBUG_SOURCE_API_ARB 0x8246
|
||||
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
|
||||
#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
|
||||
#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
|
||||
#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A
|
||||
#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B
|
||||
#define GL_DEBUG_TYPE_ERROR_ARB 0x824C
|
||||
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
|
||||
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
|
||||
#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F
|
||||
#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
|
||||
#define GL_DEBUG_TYPE_OTHER_ARB 0x8251
|
||||
#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
|
||||
#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
|
||||
#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145
|
||||
#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
|
||||
#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_vertex_buffer_object
|
||||
// GL types for handling large vertex buffer objects
|
||||
|
@ -137,6 +170,12 @@ typedef unsigned int GLhandleARB;
|
|||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
// GL_ARB_debug_output
|
||||
typedef void (APIENTRY *GLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
|
||||
typedef void (APIENTRY *GLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
|
||||
typedef void (APIENTRY *GLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam);
|
||||
typedef GLuint (APIENTRY *GLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
|
||||
|
||||
// GL_ARB_vertex_buffer_object
|
||||
typedef void (APIENTRY *GLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
|
||||
typedef void (APIENTRY *GLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
|
||||
|
|
Loading…
Add table
Reference in a new issue