Loading big texture outside display()

I’m using GLJPanel inside a Swing application for a list of screenshots,about 1024x768
I want to create textures from images when it need and not on init()
I can’t load in display() because it stop the paint for about 1sec.
i try to load with TextureIO.newTexture() in a separate Thread but it say that it is out of opengl thread…

What the best way for load big texture at runtime ?

thanks

You can load the TextureData (http://download.java.net/media/jogl/builds/nightly/javadoc_public/com/sun/opengl/util/texture/TextureData.html) via TextureIO.newTextureData() in a separate Thread and create the Texture in the next display() with a TextureIO.newTexture(textureData) call.

I have try with your suggestion but is there the same problem…
it takes 0 ms for newTextureData(bufferedimage, true) from external threa and around 1000 ms for newTexture(texdata)
why if i call getMipmapData() it return null and getBuffer() return a java.nio.HeapByteBuffer, i was thinking if i pass true to newTextureData it generates mipmapdata ? no?
can manually generate mipmap from the external Thread ?
what i’m wrong?

It’s probably the software generation of mipmaps that’s slowing you down. It’s likely the reason you’re falling back to software mipmap generation is that your images are non-power-of-two and your graphics card doesn’t have full NPOT texture support (JOGL guesses this by the presence of the GL_ARB_texture_non_power_of_two extension). I would recommend you either turn off the request to mipmap these textures, or pre-scale them to power-of-two dimensions if you can do that.

yes !
the power of 2 was the problem.
now it took few ms
thank you very much!