Hello Guest

BufferedImage Causes Crash Only in LWJGL Project

  • 3 Replies
  • 793 Views
BufferedImage Causes Crash Only in LWJGL Project
« on: June 06, 2017, 02:13:38 »
This problem may not be LWJGL, but it only occurs when it is present. I'm experiencing something really strange, and I don't know what's causing it at all. This is the problematic line of code:
Code: [Select]
BufferedImage out = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB);This code can be called anywhere, in any thread, and instantly all threads freeze. If it is called before GLFW is bound, the thread doesn't freeze, everything gets called, but the GLFW window never opens. Note: I am using Mac, so I have
Code: [Select]
-XstartOnFirstThread as a JVM argument, but I don't think that would cause it.

Actually, it is not related to that argument, it runs perfectly fine with and without it in another test project without LWJGL.
- A partial, semi-half game developer

*

Offline spasi

  • *****
  • 1972
    • WebHotelier
Re: BufferedImage Causes Crash Only in LWJGL Project
« Reply #1 on: June 06, 2017, 04:33:28 »

Re: BufferedImage Causes Crash Only in LWJGL Project
« Reply #2 on: June 07, 2017, 18:41:02 »
See this reply.

I did end up finding a solution to the problem here: https://stackoverflow.com/questions/44379870/java-creating-instance-of-bufferedimage-freezes-program. As long as I don't use it before GLFW is initialized, with that JVM argument, it works well.
- A partial, semi-half game developer

Re: BufferedImage Causes Crash Only in LWJGL Project
« Reply #3 on: July 21, 2017, 03:28:48 »
You should try to migrate away from BufferedImage though. It uses a considerable amount of Memory, and is quite slower than the STB library included with LWJGL3