[quote]No. As I have written in another post I want to generate textures.
This is my current problem with JOGL:
I have a bunch of images which i want to convert to textures. My current solution is to preload the images and put them in a list for later handling. This list is worked through when init() is called which happens only one time when the frame which belongs to my GLCanvas is made visible.
Whenever I need another texture and the game is running already (e.g. entering next level) I have to generate the texture from the display() method. But this takes some time and while doing the conversion the gui is freezed.
Is there no other possibility to handle texture generation?
Just realized that texture generation from init() is freezing the gui as well. So there is REALLY no way to do texture generation and show a JProgressBar ?!?
[/quote]
do all of your texture loading befor hand (or he majority) you can bring some new textures every frame. Or have images loaed in a separate thread and just have the GL thread send data to the GL.
i.e.
loading thread:
running()
{
while ()
{
if (ImageLoadQueue.hasMoreElements())
{
image = ImageLoadQueue.removeFront();
image.loadfromFile();
//tell the gl thread the image is loaded
sendTextureLoadedMessage(image);
}
}
}
openglThread()
{
while (texturesToLoad) { //get message from other thread with data to send to gl
glTexImage2D(…, nextTexture);
}
}
maybe each frame you cap the max textures that can be sent to GL. so it wont hang on one frame too much. Also remember to make sure things are all synced up when your using multiple threads.
Additionally you could use some of the texture compression extesnsions so your loading and sending less data.