LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: OpenGL context unavailable (Fail Fast).  (Read 179 times)

pdid

  • Newbie
  • *
  • Offline Offline
  • Posts: 22
OpenGL context unavailable (Fail Fast).
« on: August 25, 2017, 21:14:30 »

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?
Logged

Kai

  • Guest
Re: OpenGL context unavailable (Fail Fast).
« Reply #1 on: August 25, 2017, 21:38:28 »

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).
Logged