Skip to content

Commit 7d2b34f

Browse files
committed
Warn if invalid texture source
1 parent 3584923 commit 7d2b34f

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
* The `SmoothedKeyControl` minimum zoom a Camera can go to is now 0.001. Previously it was 0.1. This is to make it match the minimum zoom a Base Camera can go to. Fix #4649 (thanks @giviz)
7979
* `WebGLRenderer.lostContextCallbacks` has been removed. Please use the new `CONTEXT_LOST` event instead.
8080
* `WebGLRenderer.restoredContextCallbacks` has been removed. Please use the new `CONTEXT_RESTORED` event instead.
81+
* `TextureManager.getBase64` will now emit a console warning if you try to get a base64 from a non-image based texture, such as a WebGL Texture.
8182

8283
### Bug Fixes
8384

src/textures/TextureManager.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,11 @@ var TextureManager = new Class({
313313

314314
var textureFrame = this.getFrame(key, frame);
315315

316-
if (textureFrame && !textureFrame.source.isRenderTexture && !textureFrame.source.isGLTexture)
316+
if (textureFrame && (textureFrame.source.isRenderTexture || textureFrame.source.isGLTexture))
317+
{
318+
console.warn('Cannot getBase64 from WebGL Texture');
319+
}
320+
else if (textureFrame)
317321
{
318322
var cd = textureFrame.canvasData;
319323

0 commit comments

Comments
 (0)