Explorar el Código

Prevent webgl errors when texture is disposed before image is finished loading

Gary Hsu hace 7 años
padre
commit
40dd5453c8
Se han modificado 1 ficheros con 9 adiciones y 0 borrados
  1. 9 0
      src/Engine/babylon.engine.ts

+ 9 - 0
src/Engine/babylon.engine.ts

@@ -4251,6 +4251,15 @@
                 return;
             }
 
+            if (!texture._webGLTexture) {
+                this.resetTextureCache();
+                if (scene) {
+                    scene._removePendingData(texture);
+                }
+
+                return;
+            }
+
             this._bindTextureDirectly(gl.TEXTURE_2D, texture);
             gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));