How to make preloader in 1 GLEventListener ?

Hi
I have my small application constructed like this.
i have in GLEventListener function draw() and there

if(menu.isLoaded())
menu.draw();
else
loader.draw();

i wont to start drawing loader and then in background load all sounds and textures to the menu component. But I cant, when i start program , i see black canvas panel and then after all textures are loaded, menu , no loader is displaying :-\ Why ?
how to make loader in JOGL, please give me some idea. ???

Are you loading the textures and sounds in the init() method of the GLEventListener, because draw() won’t be called until after init() completes.

of course, the problem is that i wont add some textures in the same time as the draw function is running. ::slight_smile:

If the additional loading beyond what’s done in init() starts during your draw() method is in a separate thread, then you just have a bug within your own code and need to fix that.
If the loading occurs directly within loader.draw() without delegating anywhere else, then make sure that you’re actually drawing something before starting to load everything since otherwise nothing will be drawn until the very end, at which point everything switches to menu.draw().

And you may have to call drawable.glFlush() and/or drawable.swapBuffers() to make it appear on screen