graphics: Early return when num of vertices is 0

This commit is contained in:
Hajime Hoshi 2016-04-08 02:49:53 +09:00
parent c3d8cf2366
commit 492f471ec3

View File

@ -66,12 +66,12 @@ func drawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4
geoM: geo, geoM: geo,
colorM: color, colorM: color,
} }
p.begin()
defer p.end()
n := quads.SetVertices(vertices) n := quads.SetVertices(vertices)
if n == 0 { if n == 0 {
return nil return nil
} }
p.begin()
defer p.end()
c.BufferSubData(c.ArrayBuffer, vertices[:16*n]) c.BufferSubData(c.ArrayBuffer, vertices[:16*n])
c.DrawElements(c.Triangles, 6*n) c.DrawElements(c.Triangles, 6*n)
return nil return nil