我正在尝试将法线贴图应用于 Phaser 精灵,但在 Phaser 2.1.1(Pixi 1.6.1)中出现以下 WebGL 错误:
Could not initialise shaders phaser.js:3411
WebGL: INVALID_OPERATION: useProgram: program not valid phaser.js:3475
WebGL: INVALID_OPERATION: getUniformLocation: program not linked phaser.js:3478
WebGL: INVALID_OPERATION: getAttribLocation: program not linked phaser.js:3486
这是我的代码:
preload: function () {
game.load.script('normal', './js/NormalMapFilter.js');
game.load.image('cardfront', './img/sample-front.png');
game.load.image('cardnormal', './img/sample-front-norm.jpg');
},
create: function() {
this.cardfrontnorm = PIXI.Texture.fromImage('cardnormal');
this.normalmap = new PIXI.NormalMapFilter(this.cardfrontnorm);
this.card = game.add.sprite(game.width / 2, game.height / 2, 'cardfront');
this.card.filters = [this.normalmap];
}
精灵图像和法线贴图都是 512x512。
任何帮助将不胜感激,谢谢!