From bddd3c94676aa2718bf782f2e4cbd91359c5b428 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 4 Jun 2016 22:12:55 +0900 Subject: [PATCH] grahics: Reduce gl function calls --- internal/graphics/program.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/graphics/program.go b/internal/graphics/program.go index ba41c29be..6f4d18124 100644 --- a/internal/graphics/program.go +++ b/internal/graphics/program.go @@ -150,8 +150,9 @@ func (p *programContext) begin() { p.state.lastModelviewMatrix = nil p.state.lastColorMatrix = nil p.state.lastColorMatrixTranslation = nil + c.BindElementArrayBuffer(p.state.indexBufferQuads) + c.UniformInt(p.program, "texture", 0) } - c.BindElementArrayBuffer(p.state.indexBufferQuads) if !areSameFloat32Array(p.state.lastProjectionMatrix, p.projectionMatrix) { c.UniformFloats(p.program, "projection_matrix", p.projectionMatrix) @@ -181,8 +182,6 @@ func (p *programContext) begin() { copy(p.state.lastModelviewMatrix, modelviewMatrix) } - c.UniformInt(p.program, "texture", 0) - e := [4][5]float32{} for i := 0; i < 4; i++ { for j := 0; j < 5; j++ { @@ -220,5 +219,4 @@ func (p *programContext) begin() { } func (p *programContext) end() { - }