I’m having quite a bit of trouble getting OpenGL to work lately, and it’s driving me crazy. For some reason, when I call
glDrawElements, my GLFW window gets closed, the OpenGL context is destroyed and a segmentation fault occurs (because the graphics driver tries to draw to a non-existent context).
I haven’t encountered this issue before, and it’s very strange to me that such a thing can happen.
This is my call to
This issue only starts occuring when I put my vertex data seq into a separate object. When it’s stored as a local variable, the segmentation fault doesn’t occur, and everything renders properly. It occurs somewhere in the driver, but I can’t check where and why, because Nvidia’s drivers are closed-source. I can only tell it doesn’t occur on Mesa drivers, they simply don’t render anything.
Here’s a screenshot of what GL calls occur, as recorded by apitrace:
As far as I can tell, nothing’s calling
glXDestroyContextright at the end. I don’t call them from my code, at least, as you can see in the linked source code. The very same thing occurs when
glDrawElementsis called. If I comment out the call, those
glXDestroys don’t occur at all.
Has anyone encountered a similar issue? I’ve been debugging this for nearly two days and I just can’t think of what could be causing this. I’m using GLAD as my OpenGL wrapper, and GLFW for windowing.