- My game loads ands binds textures inside the display(GLDrawable …) method. While it works fine, I’d like to update some of the Swing components laying next to Jogl’s GLCanvas, for example a Progress bar or such.
However, these Swing components aren’t being updated when I do some JLabelXy.setText(…) inside the display method.
I added some Thread.yield and .sleep commands inside the display method to maybe give some time to the Swing thread, but with no effect.
How do you solve such problems, please?
Some details. In the game there’s the typcial small game loop in the main thread:
while (ingame) {
do Sim etc
do check key’s variables / mouse pos
GLmyCanvas.display()
}
The key and mouse listeners on the GLcanvas are being called automatically in the seperate Swing thread and just store keys etc in variables.
Probably it shouldn’t matter but the app’s runing on an ATI 3d card currently (I say this because there’s some workaround messaged being printed by Jogl).
- Part two of the question: Even if I didn’t use Swing components to display the progress but OpenGL elements, I’d have the problem that loading textures inside the display method stops anything from being rendered during that (long) cycle. How do you solve this?
(Maybe just load and bind one texture at once and delay the others to the next display call)