我正尝试将一个法线贴图应用到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大小。
任何帮助将不胜感激,谢谢!