From 7a8967c9d15ef3bcc53fcf2533ab9b438e13a16d Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Fri, 3 Feb 2017 02:09:06 +0100
Subject: [PATCH] fix TrianglesDrawer flush (SetLen)

---
 gltriangles.go | 2 +-
 graphics.go    | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/gltriangles.go b/gltriangles.go
index 2665aed..73654dd 100644
--- a/gltriangles.go
+++ b/gltriangles.go
@@ -10,7 +10,7 @@ import (
 // NewGLTriangles returns OpenGL triangles implemented using pixelgl.VertexSlice. A few notes.
 //
 // Triangles returned from this function support TrianglesPosition, TrianglesColor and
-// TrianglesTexture. If you need to support more, you can "override" Update and Append method.
+// TrianglesTexture. If you need to support more, you can "override" SetLen and Update method.
 //
 // Draw method simply draws the underlying pixelgl.VertexSlice. It needs to be called in the main
 // thread manually. Also, you need to take care of additional Target initialization or setting of
diff --git a/graphics.go b/graphics.go
index 637ea4e..85c5a26 100644
--- a/graphics.go
+++ b/graphics.go
@@ -130,6 +130,7 @@ func (td *TrianglesDrawer) flush() {
 	td.dirty = false
 
 	for _, t := range td.tris {
+		t.SetLen(td.Len())
 		t.Update(td.Triangles)
 	}
 }
-- 
GitLab