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

This commit is contained in:
Richard Davey 2018-10-01 10:38:39 +01:00
parent 56c26cfd18
commit ec6715ba8b
2 changed files with 23 additions and 12 deletions

View file

@ -71,10 +71,17 @@
* The `Texture.getFramesFromTextureSource` method was returning an array of Frame names by mistake, instead of Frame references. It now returns the Frames themselves.
* 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)
* 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)
* 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)
### Examples, Documentation and TypeScript
### Examples and TypeScript
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:
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 :)
Also, thanks to the following for helping with the Phaser 3 Examples and TypeScript definitions, either by reporting errors, or even better, fixing them:
@madanus @truncs @samme
### Phaser Doc Jam
31826615
@16patsle

View file

@ -564,6 +564,8 @@ var WebGLRenderer = new Class({
this.resize(this.width, this.height);
console.log(this.config);
this.game.events.once('texturesready', this.boot, this);
return this;
@ -631,6 +633,8 @@ var WebGLRenderer = new Class({
this.defaultCamera.setSize(width, height);
gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height);
return this;
},
@ -856,6 +860,7 @@ var WebGLRenderer = new Class({
if (width > 0 && height > 0)
{
gl.scissor(x, (this.drawingBufferHeight - y - height), width, height);
}
}
},
@ -1564,19 +1569,18 @@ var WebGLRenderer = new Class({
camera.emit('prerender', camera);
}
else if (color.alphaGL > 0)
{
this.pushScissor(cx, cy, cw, ch);
TextureTintPipeline.drawFillRect(
cx, cy, cw , ch,
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
color.alphaGL
);
}
else
{
this.pushScissor(cx, cy, cw, ch);
if (color.alphaGL > 0)
{
TextureTintPipeline.drawFillRect(
cx, cy, cw , ch,
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
color.alphaGL
);
}
}
},