Jump to content

renderTexture as filter parameter


ceiphren
 Share

Recommended Posts

Greetings,

 

I'm trying to pass the result of a renderTexture to a filter but couldn't find out how.

 

Currently I have this:

var game = new Phaser.Game(512, 512, Phaser.AUTO, '', {	preload : preload,	create : create,	update : update});var filter;var textureBuffer;var sprite;var sprite2;function preload() {	game.load.image('blueBlob', 'assets/blueBlob.png');	game.load.shader('testshader', 'srcTest/shader/testshader2.frag');};function create() {		textureBuffer = game.add.renderTexture(512, 512, 'texture1');	sprite = game.make.sprite(0, 0, 'blueBlob');	sprite.width = 512;	sprite.height = 512;	    //what do I have to pass to the uniform parameter?    var customUniforms = {            iChannel0: { type: 'sampler2D', value: textureBuffer, textureData: { repeat: true } }        };		filter = new Phaser.Filter(game, customUniforms, game.cache.getShader('testshader'));	filter.setResolution(512, 512);	sprite2 = game.add.sprite(0, 0);	sprite2.width = 512;	sprite2.height = 512;	sprite2.filters = [filter];	};function update() {	textureBuffer.render(sprite);};

What do I have to pass to the uniform so that I can work with the resultTexture in the fragment shader?

 

Regards,

 

ceiphren

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...