I am trying to create a PostFXPipeline and I need to send a texture as a uniform. I checked the docs and tutorials but couldn’t find anything about this. Can anyone explain to me how to achieve this?
I found a weird solution, I managed to do it this way:
setTexture (texture = '__DEFAULT', resizeMode){
console.log('set texture');
let phaserTexture = globals.phaserScene.game.textures.getFrame(texture);
if (!phaserTexture)
{
phaserTexture = globals.phaserScene.game.textures.getFrame('__DEFAULT');
}
this.toRatio = phaserTexture.width / phaserTexture.height;
this.targetTexture = phaserTexture.glTexture;
if (resizeMode !== undefined)
{
this.resizeMode = resizeMode;
}
this.set1i('tempTexture', 1);
// this.set1f('toRatio', this.toRatio);
return this;
}
onDraw (renderTarget)
{
// this.set1f('fromRatio', renderTarget.width / renderTarget.height);
this.bindTexture(this.targetTexture, 1);
this.bindAndDraw(renderTarget);
}