Gustavo R. A.
02-15-2012, 09:51 AM
This is the first time I try to manually load an OpenGL extension so this could be a very simple error.
I am trying to get glDebugMessageCallbackARB to call a custom function I am providing using gl3w. This is the code I am trying to make work:
typedef GLvoid (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);
typedef GLvoid (APIENTRYP DebugMessageCallbackARBPROC )(GLDEBUGPROCARB callback, GLvoid* userParam);
GLvoid APIENTRY GLMessageHandler(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) {
//Do nothing for now.
}
bool initializeOpenGLDebugOutput() {
DebugMessageCallbackARBPROC glDebugMessageCallback = (DebugMessageCallbackARBPROC)gl3wGetProcAddress("glDebugMessageCallbackARB");
if ( (glDebugMessageCallback == NULL) )
return false;
void* DebugMessageCallBackLocation = (void*)glDebugMessageCallback;
void* GLMessageHandlerLocation = (void*)&GLMessageHandler;
LOG_DEBUG_VARIABLE("OpenGL",DebugMessageCallBackLocation);
LOG_DEBUG_VARIABLE("OpenGL",GLMessageHandlerLocation);
glDebugMessageCallback(&GLMessageHandler,0);
{
std::string error = getGLErrorString();
if (error.size()!=0) {
LOG_ERROR("OpenGL",translate("Error initializing OpenGL Debug Message System."));
LOG_ERROR("OpenGL",error);
return false;
}
}
LOG_INFO("OpenGL","OpenGL Debug Message System initialized.");
return true;
};
And this is the output I am getting:
DEBUG (OpenGL): DebugMessageCallBackLocation = 0x6a216c40
DEBUG (OpenGL): GLMessageHandlerLocation = 0x437568
ERROR (OpenGL): Error initializing OpenGL Debug Message System.
ERROR (OpenGL): GL_INVALID_OPERATION
I read http://www.opengl.org/registry/specs/ARB/debug_output.txt and could not find any references to INVALID_OPERATION and the function I am using.
I am trying to get glDebugMessageCallbackARB to call a custom function I am providing using gl3w. This is the code I am trying to make work:
typedef GLvoid (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);
typedef GLvoid (APIENTRYP DebugMessageCallbackARBPROC )(GLDEBUGPROCARB callback, GLvoid* userParam);
GLvoid APIENTRY GLMessageHandler(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) {
//Do nothing for now.
}
bool initializeOpenGLDebugOutput() {
DebugMessageCallbackARBPROC glDebugMessageCallback = (DebugMessageCallbackARBPROC)gl3wGetProcAddress("glDebugMessageCallbackARB");
if ( (glDebugMessageCallback == NULL) )
return false;
void* DebugMessageCallBackLocation = (void*)glDebugMessageCallback;
void* GLMessageHandlerLocation = (void*)&GLMessageHandler;
LOG_DEBUG_VARIABLE("OpenGL",DebugMessageCallBackLocation);
LOG_DEBUG_VARIABLE("OpenGL",GLMessageHandlerLocation);
glDebugMessageCallback(&GLMessageHandler,0);
{
std::string error = getGLErrorString();
if (error.size()!=0) {
LOG_ERROR("OpenGL",translate("Error initializing OpenGL Debug Message System."));
LOG_ERROR("OpenGL",error);
return false;
}
}
LOG_INFO("OpenGL","OpenGL Debug Message System initialized.");
return true;
};
And this is the output I am getting:
DEBUG (OpenGL): DebugMessageCallBackLocation = 0x6a216c40
DEBUG (OpenGL): GLMessageHandlerLocation = 0x437568
ERROR (OpenGL): Error initializing OpenGL Debug Message System.
ERROR (OpenGL): GL_INVALID_OPERATION
I read http://www.opengl.org/registry/specs/ARB/debug_output.txt and could not find any references to INVALID_OPERATION and the function I am using.