0
\$\begingroup\$

For the past months I've been working on creating my own game engine for personal use in LWJGL using pieces here and there, especially from developer ThinMatrix's rightfully credited code, to learn as much as I can while building it. Only recently there has been strange behavior happening when I launch the engine from IntelliJ for testing:

  • After about 6-10 individual times I click run, all subsequent runs suddenly take about 60 seconds for the window to appear.

  • Whenever I restart my PC this hanging resets and I have another 6-10 runs before it hangs everytime again.

  • I located the issue to glfwInit, more specifically at the call to the native method:

      @NativeType("int")
      public static boolean glfwInit() {
          long __functionAddress = Functions.Init;
          return invokeI(__functionAddress) != 0; // Right here
      }
    
  • I also noticed that this issue only started when I attempted to implement text support in my engine using the STBTrueType library. It was perfectly fine before that. I tried removing the TrueType code but it didn't fix it.

Here's a list of things I've tried:

  • Clearing my temp folder in case a buggy or corrupted file was present.
  • Recompiling and rebuilding the entire LWJGL jars twice.
  • Building glfw.dll from the GLFW sources and replacing the glfw.dll in the native jars with the former.
  • Reinstalling Java and actually upgrading JDK versions (from 13.0.2 to 14.0.2)
  • Switching IDEs even if I suspected it wouldn't work.
  • Updating my NVIDIA drivers, and reinstalling them.

I'm quite confused as to what it could be, and I'd be more than happy to share code, thread dumps, or debug info if you deem it necessary. Here is the Github repository with the latest, "faulty" code (fault in quotes because I'm not too sure the code is the problem.)

Thank you very much for any guidance.

P.S: Please tell me if this is better asked in StackOverflow instead of here.

\$\endgroup\$
0
\$\begingroup\$

So I fixed the issue, it turns out it wasn't even related to anything to do with programming, or STBTrueType, or the library itself. The problem was as pointed out in this StackOverflow post, where this hanging behavior was due to a faulty driver or, in my case, my keyboard USB being plugged in the "wrong" USB port. I moved my computer at the same time I started working on text in my engine, hence why I wrongly linked the issue with the TrueType library. If you're having the same issue, look at the aforementioned post or if that doesn't work, look for a peripheral that might cause interference.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.