Explorar el Código

bugfix error #3694 at game startup

ncannasse hace 10 años
padre
commit
0802768e5b
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  1. 7 0
      hxd/res/Image.hx

+ 7 - 0
hxd/res/Image.hx

@@ -127,6 +127,13 @@ class Image extends Resource {
 		} else {
 			// use native decoding
 			entry.loadBitmap(function(bmp) {
+
+				// if the 3D context has been disposed while we're loading the texture, let's retry later
+				if( h3d.Engine.getCurrent().driver.isDisposed() ) {
+					haxe.Timer.delay(loadTexture, 500);
+					return;
+				}
+
 				var bmp = bmp.toBitmap();
 				tex.alloc();
 				if( bmp.width != tex.width || bmp.height != tex.height ) {