OpenGL context unavailable (Fail Fast).

Started by pdid, August 25, 2017, 21:14:30

Previous topic - Next topic

pdid

When using opengl through lwjgl, when an opengl context is made unavailable by making no context current (using glfwMakeContextCurrent(0)), the opengl calls all return 0 as a result. This can lead to unexpected results and it is often hard to see where the problem is. Is there any way of telling when a context is switched using a callback or something, so that a proper error can be filed?

Kai

Are you saying that your own program calls glfwMakeContextCurrent(0) somewhere and you don't know where that is or when/how it happens and now you want a safe-net provided by LWJGL to tell you when/where that happens?
I'd say search your source code for occurrences of glfwMakeContextCurrent(0).
If that does not yield any reasonable results, then the next best thing is to use your IDE, navigate to LWJGL's GLFW class (via source attachments of course) and install a conditional method entry breakpoint on glfwMakeContextCurrent() with the condition `window == 0L`. That will hit when anyone calls glfwMakeContextCurrent(0).