Search the Community
Showing results for tags 'WebGLTexture'.
-
I'm returning a RenderTarget object from my Filters. I would like to use the Texture from the render target and apply it onto a Sprite Object. My Code: myBlurYFilter.renderCallback = (renderTarget) => { this.mySprite.texture = renderTarget.texture;};Added a callback function to the ApplyFilter function code: if(this.renderCallback !== null) this.renderCallback(renderTarget)Resulting ApplyFilter function: BlurYFilter.prototype.applyFilter = function (renderer, input, output, clear){ var shader = this.getShader(renderer); this.uniforms.strength.value = Math.abs(this.strength) / 4 / this.passes * (input.frame.height / input.size.height); if(this.passes === 1) { renderer.filterManager.applyFilter(shader, input, output, clear); if(this.renderCallback !== null) this.renderCallback(output) } else { var renderTarget = renderer.filterManager.getRenderTarget(true); var flip = input; var flop = renderTarget; for(var i = 0; i < this.passes-1; i++) { renderer.filterManager.applyFilter(shader, flip, flop, true); var temp = flop; flop = flip; flip = temp; } renderer.filterManager.applyFilter(shader, flip, output, clear); if(this.renderCallback !== null) this.renderCallback(renderTarget) renderer.filterManager.returnRenderTarget(renderTarget); }};How can I convert the WebGLTexture Object to a PIXI.Texture Object so that I can use it on a Sprite?