LWJGLX / debug

Debugging LWJGL3 OpenGL applications
MIT License
37 stars 7 forks source link

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

Closed elect86 closed 5 years ago

elect86 commented 5 years ago

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)
    }

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

elect86 commented 5 years ago

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

httpdigest commented 5 years ago

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!

httpdigest commented 5 years ago

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?

elect86 commented 5 years ago

no.

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

httpdigest commented 5 years ago

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

elect86 commented 5 years ago

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