swing gui freezes after LWJGL Display destroy

Started by lwjuggler, December 16, 2011, 20:04:53

Previous topic - Next topic

lwjuggler

Hi all,

         i am developping a map editor with Swing. The gui is a BorderLayout and in the middle of it, I use a Display to display the game preview. So i include a Display in the gui with Display.setParent() method. When I encounter a problem, an exception while the game is running, I catch it and try to do the game continue, but it is impossible. So i tried to destroy the Display ant recreate it to have a clean nex OpenGl thread. The game preview works, it restarts, but, the swing GUI freezes ...
Does anyone has an explanation ?

CodeBunny

You restarted it in the AWT execution thread, I'm guessing, instead of spinning off a new thread. The AWT execution thread is suddenly working on updating your game, and devotes no time to processing GUI activity.

You have two ways of solving this, and one is much better than the other.

  • When you restart your game loop, do so in a new thread.
  • OR, you can take the correct way of fixing this problem, and ensure that your game doesn't crash. That's the much better and more stable option.