瀏覽代碼

fixed Texture.fromPixels : should use pixels format unless explicit set to another format

Nicolas Cannasse 4 年之前
父節點
當前提交
78fe510a7c
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      h3d/mat/Texture.hx

+ 2 - 2
h3d/mat/Texture.hx

@@ -414,8 +414,8 @@ class Texture {
 		return t;
 	}
 
-	public static function fromPixels( pixels : hxd.Pixels ) {
-		var t = new Texture(pixels.width, pixels.height);
+	public static function fromPixels( pixels : hxd.Pixels, ?format ) {
+		var t = new Texture(pixels.width, pixels.height, null, format != null ? format : pixels.format);
 		t.uploadPixels(pixels);
 		return t;
 	}