GenericPool losing textures

  ... in the unlikely case you discovered a bug, post it here.

GenericPool losing textures

Postby jaym » Mon Nov 28, 2011 4:11 am

I've ran into a problem in a project where the use of a GenericPool which is used to store particle effects is "losing" the textures upon closing & reopening the game. Anytime the Andengine process runs through its lifecycle, all objects which still remain in the pool once the game is brought back into main focus lose their texture (ie. effects will not appear on screen).

So far, I've noticed this is only a problem for particles because I've only used these pools for particles (so far), but I would assume the same situation would arise for sprites being used in a similar manner.

To reproduce this bug, simply create a GenericPool which stores a particle system. Apply this particle effect to your scene via touch or a button, run the game and press the screen to obtain an item from the pool. Close the application and reopen, pressing your screen (once) to display the effects. You will notice there will be no particles on the screen as it's reusing an item currently stored in the pool which has lost its texture. But tap your screen twice quickly so that the pool must obtain a second particle system and you will only see the second (because a new particle is being created with a fresh texture).
AndEngine for Android Game Development Cookbook - Based on AndEngine's latest, greatest, GLES2.0 AnchorCenter branch!
jaym
 
Posts: 690
Joined: Wed May 04, 2011 10:08 pm

Re: GenericPool losing textures

Postby jaym » Thu Dec 01, 2011 11:40 pm

I've made a slight modification to Andengine in order to fix this issue. I ended up adding a pool dump function to the GenericPool class, which should be called in the onDestroy portion of Andengine's lifecycle.

Add this simple code to the pool class and you'll be good to go.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         public synchronized void dumpPoolItems(){
  2.                 if(!mAvailableItems.isEmpty())
  3.                 mAvailableItems.clear();
  4.         }
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


I have not done too much research into this so there may be a better way of fixing this issue. If anyone decides to test this vs simply reloading textures, let me know. I just decided this way would be best because if a pool is still active while the process is minimized it may still be holding some system resources. This is why I decide to dump instead of keep the pools intact.
AndEngine for Android Game Development Cookbook - Based on AndEngine's latest, greatest, GLES2.0 AnchorCenter branch!
jaym
 
Posts: 690
Joined: Wed May 04, 2011 10:08 pm

Request for a look in similar issue

Postby REDD LABS » Mon Jun 24, 2013 7:25 am

Hi sir,
I am suffering of a similar issue, I am developing a live wallpaper using Andengine GLES2 Anchor center branch as per our Andengine cook book, but I am stuck with loosing textures on Low end devices I have posted the details here http://www.andengine.org/forums/live-wallpaper-extension/loosing-textures-on-low-end-devices-t12402.html, I have posted the same in stack overflow too http://stackoverflow.com/questions/17259444/andengine-live-wallpaper-loosing-textures-on-low-end-device. It will be very help full for us , If we get any suggestions from the Andengine Gurus like you.

Hopefully
Renjith KN and all from REDD LABS
REDD LABS
 
Posts: 11
Joined: Tue Jan 29, 2013 6:02 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 3 guests