heyx3 / Bplus.jl

A modern OpenGL 4.6 rendering framework, written in Julia.
Other
70 stars 3 forks source link

Revisit the older, better OpenGL debugging and error reporting #24

Open heyx3 opened 1 year ago

heyx3 commented 1 year ago

The old code can be found at the bottom of GL/debugging.jl, below the new code. And the old code is enabled within the GL.Context constructor, under the if debug_mode block.

I was running into problems with hooking callbacks into OpenGL's error reporting. However, I later found out that I was doing C callbacks incorrectly. They have to be set up on __init__, not during precompilation, because you are allocating a function pointer and pointers are not going to be the same across different program runs.

So now that I know why it wasn't working, we should revisit it! The older form of OpenGL error detection that I'm using is much uglier.

heyx3 commented 1 year ago

Another change that I made a while ago, which may have been important in making this work, is the use of GLFW.WindowHint(GLFW.OPENGL_DEBUG_CONTEXT, true) when debug_mode is true. Might be worth investigating the exact relationship between these two things.