WebGLRenderer.deleteTexture will check to see if the texture it is being asked to delete is the currently bound texture or not. If it is, it'll set the blank texture to be bound after deletion. This should stop RENDER WARNING: there is no texture bound to the unit 0 errors if you destroy a Game Object, such as Text or TileSprite, from an async or timed process

This commit is contained in:
Richard Davey 2018-10-01 16:32:42 +01:00
parent ad2ef6a742
commit 5bdf9aa21b
2 changed files with 8 additions and 0 deletions

View file

@ -6,6 +6,8 @@
### Updates ### Updates
* `WebGLRenderer.deleteTexture` will check to see if the texture it is being asked to delete is the currently bound texture or not. If it is, it'll set the blank texture to be bound after deletion. This should stop `RENDER WARNING: there is no texture bound to the unit 0` errors if you destroy a Game Object, such as Text or TileSprite, from an async or timed process (thanks jamespierce)
### Bug Fixes ### Bug Fixes
### Examples and TypeScript ### Examples and TypeScript

View file

@ -1470,6 +1470,12 @@ var WebGLRenderer = new Class({
this.gl.deleteTexture(texture); this.gl.deleteTexture(texture);
if (this.currentTextures[0] === texture)
{
// texture we just deleted is in use, so bind a blank texture
this.setBlankTexture(true);
}
return this; return this;
}, },