From 43cd5e4b3f074eef17194e5c4b48b3d82caa562d Mon Sep 17 00:00:00 2001 From: photonstorm Date: Thu, 27 Feb 2014 23:28:28 +0000 Subject: [PATCH] Fixed the Tunnel filter. Had to patch Pixi to do it :( But no other choice for now until they merge my pull request. --- examples/filters/tunnel.js | 2 +- filters/Tunnel.js | 2 ++ src/pixi/renderers/webgl/shaders/PixiShader.js | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/filters/tunnel.js b/examples/filters/tunnel.js index 2b875b59..cf5dca2f 100644 --- a/examples/filters/tunnel.js +++ b/examples/filters/tunnel.js @@ -35,6 +35,6 @@ function update() { filter.update(); // Uncomment for coolness :) - filter.origin = filter.origin + 0.001; + // filter.origin = filter.origin + 0.001; } diff --git a/filters/Tunnel.js b/filters/Tunnel.js index 7b77db6b..5cd66998 100644 --- a/filters/Tunnel.js +++ b/filters/Tunnel.js @@ -42,6 +42,8 @@ Phaser.Filter.Tunnel.prototype.init = function (width, height, texture) { this.setResolution(width, height); this.uniforms.iChannel0.value = texture; + texture.baseTexture._powerOf2 = true; + } Object.defineProperty(Phaser.Filter.Tunnel.prototype, 'alpha', { diff --git a/src/pixi/renderers/webgl/shaders/PixiShader.js b/src/pixi/renderers/webgl/shaders/PixiShader.js index a6e6b13d..1abfd39c 100644 --- a/src/pixi/renderers/webgl/shaders/PixiShader.js +++ b/src/pixi/renderers/webgl/shaders/PixiShader.js @@ -185,7 +185,7 @@ PIXI.PixiShader.prototype.initSampler2D = function(uniform) var gl = this.gl; gl.activeTexture(gl['TEXTURE' + this.textureCount]); - gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTexture); + gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]); // Extended texture data if (uniform.textureData) @@ -259,7 +259,6 @@ PIXI.PixiShader.prototype.syncUniforms = function() // This would probably be faster in an array and it would guarantee key order for (var key in this.uniforms) { - uniform = this.uniforms[key]; if (uniform.glValueLength === 1)