Phaser/Pixi法线贴图滤镜不起作用

3

我正尝试将一个法线贴图应用到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大小。

任何帮助将不胜感激,谢谢!


如果您可以将其发布在jsfiddle或类似网站上,我会检查是否出现相同的错误。 - imcg
@imcg 很遗憾,由于CORS限制和通过js加载的资源,这有点困难。 - Chris Clower
我也遇到了同样的问题。你解决了吗? - AKG
1个回答

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接