mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
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
This commit is contained in:
parent
a17b0c2e6c
commit
d8fcde46c3
4 changed files with 24 additions and 8 deletions
|
@ -50,6 +50,7 @@
|
|||
* `TextureTintPipeline.batchTexture` has a new optional argument `skipFlip` which allows you to control the internal render texture flip Y check.
|
||||
* The Device.OS check for `node` will now do a `typeof` first to avoid issues with rollup packaged builds needing to shim the variable out. Fix #4058 (thanks @hollowdoor)
|
||||
* Arcade Physics Bodies will now sync the display origin of the parent Game Object to the body properties as part of the `updateBounds` call. This means if you change the origin of an AP enabled Game Object, after creation of the body, it will be reflected in the body position. This may or may not be a breaking change for your game. Previously it was expected that the origin should always be 0.5 and you adjust the body using `setOffset`, but this change makes a bit more sense logically. If you find that your bodies are offset after upgrading to this version then this is likely why. Close #4052 (thanks @SolarOmni)
|
||||
* The `Texture.getFramesFromTextureSource` method has a new boolean argument `includeBase`, which defaults to `false` and allows you to set if the base frame should be returned into the array or not.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
@ -60,6 +61,8 @@
|
|||
* The `Shape.Line` object was missing a `lineWidth` property unless you called the `setLineWidth` method, causing the line to not render in Canvas only. Fix #4068 (thanks @netgfx)
|
||||
* All parts of Matter Body now have the `gameObject` property set correctly. Previously only the first part of the Body did.
|
||||
* When using `MatterGameObject` and `fromVerts` as the shape type it wouldn't pass the values to `Bodies.fromVertices` because of a previous conditional. It now passes them over correctly and the body is only set if the result is valid.
|
||||
* 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)
|
||||
|
||||
### Examples, Documentation and TypeScript
|
||||
|
||||
|
|
|
@ -1493,9 +1493,9 @@ var Graphics = new Class({
|
|||
// var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix, renderTargetCtx, allowClip)
|
||||
this.renderCanvas(renderer, this, 0, Graphics.TargetCamera, null, ctx, false);
|
||||
|
||||
if (renderer.gl && texture)
|
||||
if (texture)
|
||||
{
|
||||
texture.source[0].glTexture = renderer.canvasToTexture(ctx.canvas, texture.source[0].glTexture);
|
||||
texture.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1817,11 +1817,6 @@ var WebGLRenderer = new Class({
|
|||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (dstTexture)
|
||||
{
|
||||
this.deleteTexture(dstTexture);
|
||||
}
|
||||
|
||||
var wrapping = gl.CLAMP_TO_EDGE;
|
||||
|
||||
if (IsSizePowerOfTwo(srcCanvas.width, srcCanvas.height))
|
||||
|
@ -1829,7 +1824,14 @@ var WebGLRenderer = new Class({
|
|||
wrapping = gl.REPEAT;
|
||||
}
|
||||
|
||||
return this.createTexture2D(0, gl.NEAREST, gl.NEAREST, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true);
|
||||
var newTexture = this.createTexture2D(0, gl.NEAREST, gl.NEAREST, wrapping, wrapping, gl.RGBA, srcCanvas, srcCanvas.width, srcCanvas.height, true);
|
||||
|
||||
if (newTexture && dstTexture)
|
||||
{
|
||||
this.deleteTexture(dstTexture);
|
||||
}
|
||||
|
||||
return newTexture;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -235,6 +235,17 @@ var TextureSource = new Class({
|
|||
if (this.renderer.gl && this.isCanvas)
|
||||
{
|
||||
this.glTexture = this.renderer.canvasToTexture(this.image, this.glTexture);
|
||||
|
||||
// Update all the Frames using this TextureSource
|
||||
|
||||
var index = this.texture.getTextureSourceIndex(this);
|
||||
|
||||
var frames = this.texture.getFramesFromTextureSource(index, true);
|
||||
|
||||
for (var i = 0; i < frames.length; i++)
|
||||
{
|
||||
frames[i].glTexture = this.glTexture;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue