phaser
phaser copied to clipboard
Bug: add shader gameobject can only pass a img which width and heigth is power-of-2
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.
Additional Information
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.