Skip to content

Commit ec6715b

Browse files
committed
Fixed a bug where the gl scissor wasn't being reset during a renderer resize, causing it to appear as if the canvas didn't resize properly when autoResize was set to true in the game config. Fix phaserjs#4066
1 parent 56c26cf commit ec6715b

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,17 @@
7171
* The `Texture.getFramesFromTextureSource` method was returning an array of Frame names by mistake, instead of Frame references. It now returns the Frames themselves.
7272
* When using `CanvasTexture.refresh` or `Graphics.generateTexture` it would throw WebGL warnings like 'bindTexture: Attempt to bind a deleted texture'. This was due to the Frames losing sync with the glTexture reference used by their TextureSource. Fix #4050 (thanks @kanthi0802)
7373
* Fixed an error in the `batchSprite` methods in the Canvas and WebGL Renderers that would incorrectly set the frame dimensions on Sprites with the crop component. This was particularly noticeable on Sprites with trimmed animation frames (thanks @sergeod9)
74+
* Fixed a bug where the gl scissor wasn't being reset during a renderer resize, causing it to appear as if the canvas didn't resize properly when `autoResize` was set to `true` in the game config. Fix #4066 (thanks @Quinten @hsan999)
7475

75-
### Examples, Documentation and TypeScript
76+
### Examples and TypeScript
7677

77-
My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs:
78+
A huge thanks to @presidenten for his work on the Phaser 3 Examples. You'll notice they now have a lovely screen shots for every example and the scripts generate them automatically :)
79+
80+
Also, thanks to the following for helping with the Phaser 3 Examples and TypeScript definitions, either by reporting errors, or even better, fixing them:
81+
82+
@madanus @truncs @samme
83+
84+
### Phaser Doc Jam
7885

7986
31826615
8087
@16patsle

src/renderer/webgl/WebGLRenderer.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,8 @@ var WebGLRenderer = new Class({
564564

565565
this.resize(this.width, this.height);
566566

567+
console.log(this.config);
568+
567569
this.game.events.once('texturesready', this.boot, this);
568570

569571
return this;
@@ -631,6 +633,8 @@ var WebGLRenderer = new Class({
631633

632634
this.defaultCamera.setSize(width, height);
633635

636+
gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height);
637+
634638
return this;
635639
},
636640

@@ -856,6 +860,7 @@ var WebGLRenderer = new Class({
856860
if (width > 0 && height > 0)
857861
{
858862
gl.scissor(x, (this.drawingBufferHeight - y - height), width, height);
863+
859864
}
860865
}
861866
},
@@ -1564,19 +1569,18 @@ var WebGLRenderer = new Class({
15641569

15651570
camera.emit('prerender', camera);
15661571
}
1567-
else if (color.alphaGL > 0)
1568-
{
1569-
this.pushScissor(cx, cy, cw, ch);
1570-
1571-
TextureTintPipeline.drawFillRect(
1572-
cx, cy, cw , ch,
1573-
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
1574-
color.alphaGL
1575-
);
1576-
}
15771572
else
15781573
{
15791574
this.pushScissor(cx, cy, cw, ch);
1575+
1576+
if (color.alphaGL > 0)
1577+
{
1578+
TextureTintPipeline.drawFillRect(
1579+
cx, cy, cw , ch,
1580+
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
1581+
color.alphaGL
1582+
);
1583+
}
15801584
}
15811585
},
15821586

0 commit comments

Comments
 (0)