0
votes

I'm trying to debug my opengl program. and trying to use the error logging function. glDebugMessageCallback. However the only examples i can find use "typedef void (APIENTRY *DEBUGPROC)" or void APIENTRY glDebugOutput(...). and i know APIENTRY is a windows WINAPI based compiler flag, soo, how do i write a function that will work on linux using g++ compiler?... is it even possible? if i try to it without that i get..

error: invalid conversion from ‘void* ()(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar, void*)’ {aka ‘void* ()(unsigned int, unsigned int, unsigned int, unsigned int, int, const char, void*)’} to ‘GLDEBUGPROC’ {aka ‘void ()(unsigned int, unsigned int, unsigned int, unsigned int, int, const char, const void*)’} [-fpermissive]

1
At least the mesa gl.h (which you are probably using on linux) defines #define APIENTRY GLAPIENTRY. So that should be a non-issue.BDL

1 Answers

2
votes

According to the OpenGL 4.6 spec, Section 20.2 Debug Message Callback

callback must be a function whose prototype is of the form

void callback( enum source, enum type, uint id,
               enum severity, sizei length, const char *message,
               const void *userParam );

The definition does not contain any mentioning of APIENTRY. But even if so, most gl.h files will contain a definition similar to

#define APIENTRY GLAPIENTRY

But all of this has nothing to do with your problem. The real problem you have is that your function parameter do not match the debug message callback definition. As the error message states:

void* () (unsigned int, unsigned int, unsigned int, unsigned int, int, const char, void*)
does not match
void ()(unsigned int, unsigned int, unsigned int, unsigned int, int, const char, const void*)

Basically, you are missing a const for the last parameter.