Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 带相位器的误差WebGL_Javascript_Html_Phaser Framework - Fatal编程技术网

Javascript 带相位器的误差WebGL

Javascript 带相位器的误差WebGL,javascript,html,phaser-framework,Javascript,Html,Phaser Framework,我尝试使用Phaser制作我的第一个游戏,但当我对自己的图像使用tileSprite函数时,出现了一个错误: 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); “grou

我尝试使用Phaser制作我的第一个游戏,但当我对自己的图像使用tileSprite函数时,出现了一个错误:

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);
“ground.png”显示为黑色,我在控制台中遇到以下错误:

错误:WebGL:纹理将被渲染为黑色, 根据OpenGL ES 2.0.24规范第3.8.2节,因为它是2D 纹理,带有不需要mipmap的缩小过滤器,具有 宽度或高度不是二的幂,且包裹模式不同 从夹具到边缘

使用相同的代码,但其他图片(来自演示phaser游戏),我没有得到这个错误


精灵的宽度和高度必须是二的幂:

错误:WebGL:根据OpenGL ES 2.0.24规范第3.8.2节,纹理将被渲染为黑色,因为它是一种2D纹理,具有不需要mipmap的缩小过滤器,其宽度或高度不是二的幂,并且具有不同于“钳制”到“边缘”的包裹模式

(我强调)

你的栅栏是两个精灵的幂,宽128px,高16px,然而,你的“塔皮”(不管是什么)是19x13,这不是二的幂

二的幂是它背后的实际数学,即
2^n
,其中
n
是任何正整数。所有的宽度和高度测量值必须是与二次幂匹配的值