General question about TextureState [update] performance collapse after delete()

Hi all,

after trying to load an image sequence to an array of Textures and having a nice animated texture my thoughts are now on performance because I want to have a large number of geos using this texure. To have some difference the objects start using the texture with a frame offset. In my testing scenario I have a 50 frame image sequence and 150 spheres attached directly to the rootNode. These spheres are supposed to use the animated texture.

Basically, here is what I did so far

  • loading a sequence into a Texture array (length of 50 in this case)
  • to save memory I thought it would be better to have 50 different TextureStates (one for each different frame) instead of having 150
  • the different TextureStates assigned by random to each sphere
  • on update() I call setTexture(tex) to have a new image used by TextureState

    The first seconds I get a really nice animated texture but the memory usage is increasing. After a couple of time the memory usage will be cutted down and starts increasing again. During this cut down I get rendering drop out. As time goes by the memory cut periods become shorter. Finally the performance is totally down.

    So my question is, how do I have to manage the data/textures and states to save memory and avoid these cut downs?

    Many thanks in advance



well, meanwhile I located the line where the memory increase comes from

first - here is how I start initializing the texture/texturestate arrays

   Texture[]                sequence;
   TextureState[]            states;

The image sequence is loaded by calling:

   public void loadSequence(int length, String path, String file, String suffix)
      this.length   = length;
      sequence    = new Texture[length];
      pointer      = 0;

      String numStr;