浏览代码

WebGLTextures: Make test in resizeImage() more robust.

Mugen87 6 年之前
父节点
当前提交
2604380998
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/renderers/webgl/WebGLTextures.js

+ 3 - 1
src/renderers/webgl/WebGLTextures.js

@@ -42,7 +42,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 			// only perform resize for certain image types
 
-			if ( image instanceof HTMLImageElement || image instanceof HTMLCanvasElement || image instanceof ImageBitmap ) {
+			if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
+				( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
+				( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
 
 				var floor = needsPowerOfTwo ? _Math.floorPowerOfTwo : Math.floor;