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 theglfw.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.