Skip to content

Commit 1465d18

Browse files
committed
Merge pull request phaserjs#2326 from englercj/dev
Fix phaserjs#2320: properly size filter texture and viewport
2 parents 12c529f + 5b7130d commit 1465d18

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/pixi/renderers/webgl/utils/WebGLFilterManager.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ PIXI.WebGLFilterManager.prototype.pushFilter = function(filterBlock)
9393
var texture = this.texturePool.pop();
9494
if(!texture)
9595
{
96-
texture = new PIXI.FilterTexture(this.gl, this.width, this.height);
96+
texture = new PIXI.FilterTexture(this.gl, this.width * this.renderSession.resolution, this.height * this.renderSession.resolution);
9797
}
9898
else
9999
{
100-
texture.resize(this.width, this.height);
100+
texture.resize(this.width * this.renderSession.resolution, this.height * this.renderSession.resolution);
101101
}
102102

103103
gl.bindTexture(gl.TEXTURE_2D, texture.texture);
@@ -120,7 +120,7 @@ PIXI.WebGLFilterManager.prototype.pushFilter = function(filterBlock)
120120
gl.bindFramebuffer(gl.FRAMEBUFFER, texture.frameBuffer);
121121

122122
// set view port
123-
gl.viewport(0, 0, filterArea.width, filterArea.height);
123+
gl.viewport(0, 0, filterArea.width * this.renderSession.resolution, filterArea.height * this.renderSession.resolution);
124124

125125
projection.x = filterArea.width/2;
126126
projection.y = -filterArea.height/2;
@@ -158,7 +158,7 @@ PIXI.WebGLFilterManager.prototype.popFilter = function()
158158

159159
if(filterBlock.filterPasses.length > 1)
160160
{
161-
gl.viewport(0, 0, filterArea.width, filterArea.height);
161+
gl.viewport(0, 0, filterArea.width * this.renderSession.resolution, filterArea.height * this.renderSession.resolution);
162162

163163
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
164164

@@ -187,8 +187,8 @@ PIXI.WebGLFilterManager.prototype.popFilter = function()
187187

188188
var inputTexture = texture;
189189
var outputTexture = this.texturePool.pop();
190-
if(!outputTexture)outputTexture = new PIXI.FilterTexture(this.gl, this.width, this.height);
191-
outputTexture.resize(this.width, this.height);
190+
if(!outputTexture)outputTexture = new PIXI.FilterTexture(this.gl, this.width * this.renderSession.resolution, this.height * this.renderSession.resolution);
191+
outputTexture.resize(this.width * this.renderSession.resolution, this.height * this.renderSession.resolution);
192192

193193
// need to clear this FBO as it may have some left over elements from a previous filter.
194194
gl.bindFramebuffer(gl.FRAMEBUFFER, outputTexture.frameBuffer );

0 commit comments

Comments
 (0)