melonJS icon indicating copy to clipboard operation
melonJS copied to clipboard

Animation broken on WebGL if TextureAtlas has multiple textures

Open CodeAndWeb opened this issue 2 years ago • 9 comments
trafficstars

When an animated sprite is created with createAnimationFromName() on a TextureAtlas which has multiple textures ("multi-pack"), all animation frames must be placed on the first texture. Otherwise the animation is broken:

broken-animation

To Reproduce

  1. git clone -b multipack-broken https://github.com/CodeAndWeb/melonjs-sprite-sheet-example.git
  2. npm run dev

CodeAndWeb avatar Oct 17 '23 09:10 CodeAndWeb

oh ! interesting ! thank you for reporting it !

obiot avatar Oct 17 '23 09:10 obiot

Same problem when creating a single sprite with atlas.createSpriteFromName("spritename"). Is multi-pack supported at all? or am I doing something wrong?

CodeAndWeb avatar Oct 17 '23 10:10 CodeAndWeb

well it is supposed to be supported, but I guess either with limitations, or we had some regression in the last few versions, I'll definitely look into it

obiot avatar Oct 17 '23 10:10 obiot

Hi, so I cloned your git, executed it and ...... it's just working here .... Oct-18-2023 09-44-31

is there something I'm missing to reproduce the bug ?

obiot avatar Oct 18 '23 01:10 obiot

Have you checked out the "multipack-broken" branch?

CodeAndWeb avatar Oct 18 '23 06:10 CodeAndWeb

of course it did not.... sorry, I did not realize there was a specific branch for it. Saw it now and indeed it's not working properly

obiot avatar Oct 18 '23 07:10 obiot

Dear Olivier,

Facing same problem on WebGL:

bildo

Canvas is working fine:

bildo

Have already updated my package to the latest melonJS release

customautosys avatar Dec 29 '23 03:12 customautosys

wow thank you ! I was really scratching my head with this one, looking at the logic implementation of the multi-texture TextureAtlas support, and could not find what was wrong. Now thank to you, I know that the issue is with the WebGL renderer, and now I know where to look !

obiot avatar Dec 30 '23 08:12 obiot

I managed to pin point the issue, it's actually a regression following that change : https://github.com/melonjs/melonJS/commit/16c5d3c8e369a333e1dde7be3482cd32d50d472d

obiot avatar Dec 31 '23 02:12 obiot

fixed in version 17.3.0

obiot avatar Jun 04 '24 08:06 obiot