浏览代码

fix for empty graphics

David "Blackmagic" Elahee 11 年之前
父节点
当前提交
9a2d457184
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      h2d/Graphics.hx

+ 2 - 0
h2d/Graphics.hx

@@ -58,6 +58,7 @@ private class GraphicsContent extends h3d.prim.Primitive {
 	}
 	
 	override function alloc( engine : h3d.Engine ) {
+		if (index.length <= 0) return ;
 		buffer = engine.mem.allocVector(tmp, 8, 0);
 		indexes = engine.mem.allocIndex(index);
 		for( b in buffers ) {
@@ -67,6 +68,7 @@ private class GraphicsContent extends h3d.prim.Primitive {
 	}
 	
 	override function render( engine : h3d.Engine ) {
+		if (index.length <= 0) return ;
 		if( buffer == null || buffer.isDisposed() ) alloc(engine);
 		for( b in buffers )
 			engine.renderIndexed(b.vbuf, b.ibuf);