Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spritsheet to texture is reversed #6017

Closed
Grandnainconnu opened this issue Feb 19, 2022 · 5 comments
Closed

Spritsheet to texture is reversed #6017

Grandnainconnu opened this issue Feb 19, 2022 · 5 comments

Comments

@Grandnainconnu
Copy link

Grandnainconnu commented Feb 19, 2022

Version

  • Phaser Version: 3.55.2
  • Operating system: Mac OS
  • Browser:

Description

When creating a texture from a spritesheet, then drawing the sprite, the frame order is reversed.
For example, if a spritesheet has 8 drawings of each 32x32 pixels, when drawing the sprite from the created texture, frame 0 will display the drawing number 8.

Example Test Code

https://codepen.io/Hetarnam/pen/zYPEPVB

Additional Information

Following of issue #6008 that has been closed without answer about the main concern, so I changed the sprite to a correct one on the pen and the issue is still there.

@photonstorm
Copy link
Collaborator

Frames are never reversed.

Yet again the spritesheet in the codepen is invalid. The image is 249 x 497. You cannot divide this by 31 pixels evenly, so it won't be split into frames as you expect it.

Use a properly sized spritesheet and it will display the correct frame.

@Grandnainconnu
Copy link
Author

Grandnainconnu commented Feb 20, 2022

Frames are never reversed.

Yet again the spritesheet in the codepen is invalid. The image is 249 x 497. You cannot divide this by 31 pixels evenly, so it won't be split into frames as you expect it.

Use a properly sized spritesheet and it will display the correct frame.

Ok my bad again ! I changed the image for one in a tutorial that is definitely the good size 32x32, and the problem is still there.
Frame one of the texture displays frame 92

@samme
Copy link
Contributor

samme commented Feb 24, 2022

I reproduced this, I think, with the WEBGL renderer only:

https://codepen.io/samme/pen/zYPLLyw?editors=0010

@Grandnainconnu
Copy link
Author

I reproduced this, I think, with the WEBGL renderer only:

https://codepen.io/samme/pen/zYPLLyw?editors=0010

Yes you're right, when I switch to CANVAS the problem disappear

photonstorm added a commit that referenced this issue May 30, 2022
… flag a Render Texture as being used as the source for Sprite Game Object textures. You can also toggle the new boolean property `isSpriteTexture` as well. Doing this ensures that images drawn to the Render Texture are correctly inverted for rendering in WebGL. Not doing so can cause inverted frames. If you use this method, you must use it before drawing anything to the Render Texture. Fix #6057 #6017
@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants