AndEngine icon indicating copy to clipboard operation
AndEngine copied to clipboard

SpriteGroup blinks on newly attachChild

Open flomin opened this issue 12 years ago • 1 comments

I'm using the last version of the AndEngine, branch GLES2, with two devices: HTC Desire and a Galaxy Nexus.

I have a problem when using a SpriteGroup with Sprites scrolling down on the screen. New sprites are attached to a SpriteGroup on the top of the screen and detached when they go off the bottom. And I use a pool to avoid using to much memory.

As soon as there are some sprites detached, some newly attached sprites begin to blink randomly for a few frames. This is very annoying and I have no idea why...

I tried to setVisible(false) the sprites when recycling them, I also tried without the pool but it doesn't change a thing.

I think that SpriteGroup may have a bug, but not sure where. I tried to attach the children in SpriteGroup in the begin() method to be sure it didn't happen during the loop of onUpdateSpriteBatch(), without luck.

An example based on the AndEngineExamples project can be found on SO here: http://stackoverflow.com/questions/12499370/andengine-spritegroup-blinks-on-newly-attachchild You can directly replace the SpriteBatchExample class, launch the project and go to Simple/Drawing a SpriteBatch, to see the problem.

flomin avatar Nov 05 '12 11:11 flomin

I think I had something similar , might it be because they share the same vertex buffer? I remember having a group and setting the visibility or detaching, it too would blink. I think I had to end up just with single sprites instead.

Niffy avatar Dec 09 '12 16:12 Niffy