Debug OpenGL generator calls glGetError after glBegin
Hello!
I have started a tiny toy project, where I use old OpenGL for simplicity.
I load OpenGL functions using GLAD, which is integrated via conan2 with default settings.
And I noticed that I get spam of ERROR 1282 in glEnd in the console every time I call glBegin + glEnd, even if there is nothing in between.
The spam happens only in Debug build but not in Release.
Because the conan package specifies GLAD_GENERATOR = c-debug instead of c in Debug build (in this line).
And in this case GLAD code calls _post_call_callback_default_gl after glBegin, which calls glad_glGetError.
However, it turns out that calling glGetError inside glBegin/glEnd scope is not allowed =)
No idea if this issue is worth fixing though, given that immediate mode rendering is quite dead today. I guess I can workaround the issue by forcing conan to always use Release build of GLAD.
P.S. Thank you very much for the loader! I used it in the past, and was very glad with how it worked =)
Oof, that is quite a tricky issue I didn't consider.
- I think we could track each pair of invocations from
glBegintoglEndand not call that in the error hook. - Looking at the man page, it seems like
GL_INVALID_OPERATIONis only generated when called betweenglBeginandglEnd... so we could also just ignore that error (obviously this will mean additionalgl*calls, but the debug mode isn't supposed to be very efficient anyways)