phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Bug: add shader gameobject can only pass a img which width and heigth is power-of-2

Open fengli-master opened this issue 7 years ago • 1 comments

Version

  • Phaser Version: 3.18.1
  • Operating system: MacOS
  • Browser: Chrome

Description

add shader method can only pass a img which width and heigth is power-of-2

Example Test Code

var shader = this.add.shader('Tunnel', 400, 300, 800, 600, [ 'metal' ]);

For example, if "metal" img width is not power-of-2, there is an error as below, it's easy to present in the phaser3-example repository.

屏幕快照 2019-08-07 17 27 19

Additional Information

fengli-master avatar Aug 07 '19 09:08 fengli-master

This is because the Tunnel shader in that example requires a POT texture, rather than a bug in the Shader Game Object. Lots of shaders have this requirement. It's up to you to either provide a POT texture or code your shader in such a way that it can work with NPOT textures.

photonstorm avatar Aug 07 '19 10:08 photonstorm