LWJGLX/debug

org.lwjglx.debug.opengl.GL.createCapabilities(GL.java:59) fires java.lang.NullPointerException

Closed this issue · 6 comments

Hi,

as titled, it crashes here:

    Context context = CURRENT_CONTEXT.get();
    context.caps = caps;

I double cheched and context is indeed null

In my app I do the following:

    glfwWindow = GlfwWindow.fromWin32Window(hwnd).apply {
        makeContextCurrent()
        println("current: $isCurrent")
        createCapabilities(forwardCompatible = false)
    }
  • create the glfw window
  • make context current
  • check if it's really current (glfwGetCurrentContext == window.handle)
  • and then create the capabilities with the desidered forwardCompatibility option

And the last step is exactly where debug crashes

What is wrong?

ps: glfw is already initialized at that point, I also have GLFWErrorCallback.createPrint().set() but I dont get any error from there

I cant reproduce anymore, don't know what was the problem..

Hmm.. you would get this exception if you had called glfwMakeContextCurrent with 0L while no context was current at the moment. This bug should not happen, of course, and I will fix this. Thanks for mentioning!

Actually, what I wrote above was wrong. I've tried a few things but cannot reproduce this error also. Do you happen to use multiple threads and migrate the GL context between different threads?

no.

I'm sorry I cannot specify what caused that, probably too much spaghetti debugging..

Alrighty then. :) When it happens again, I'd be glad if you could post here again.

Sure, thanks for the cool lib, I fixed glfwInit() to be called from the main thread though