Вопрос

I try to make my first game with Phaser but I got an error when i use the tileSprite function with my own image :

this.game.load.image('ground', 'assets/ground.png');
this.ground = this.game.add.tileSprite(0, game.world.height - 432, game.world.width, 281, 'ground');
this.ground.tileScale.setTo(2, 2);

The "ground.png" appear black and i get this error in my console :

Error: WebGL: A texture is going to be rendered as if it were black, as per the OpenGL ES 2.0.24 spec section 3.8.2, because it is a 2D texture, with a minification filter not requiring a mipmap, with its width or height not a power of two, and with a wrap mode different from CLAMP_TO_EDGE.

With the same code but others images (from demo phaser game) I dont get this error.

Here is my PNG (who get the error)

Here is another PNG who working good

Это было полезно?

Решение

The sprite's width and height must be powers of two:

Error: WebGL: A texture is going to be rendered as if it were black, as per the OpenGL ES 2.0.24 spec section 3.8.2, because it is a 2D texture, with a minification filter not requiring a mipmap, with its width or height not a power of two, and with a wrap mode different from CLAMP_TO_EDGE.

(Emphasis by me)

Your fence is a power of two sprite, with 128px width and 16px height, however, your "Tapis" (whatever that is) is 19x13, which are not powers of two.

Power of two is the actual mathematics behind it, that is 2^n, where n is any positive integer. All your widht and height measurements must be values that match a power of two.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top