From 7a96f31b1f54127b148ae9b3af779b028a81750a Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 16 Jul 2016 02:07:16 +0900 Subject: [PATCH] graphics: Hide MaxQuads --- internal/graphics/command.go | 4 ++-- internal/graphics/program.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/graphics/command.go b/internal/graphics/command.go index f3facd379..674e7ab48 100644 --- a/internal/graphics/command.go +++ b/internal/graphics/command.go @@ -77,8 +77,8 @@ func (q *commandQueue) Flush(context *opengl.Context) error { } // NOTE: WebGL doesn't seem to have Check gl.MAX_ELEMENTS_VERTICES or gl.MAX_ELEMENTS_INDICES so far. // Let's use them to compare to len(quads) in the future. - if MaxQuads < len(vertices)/16 { - return errors.New(fmt.Sprintf("len(quads) must be equal to or less than %d", MaxQuads)) + if maxQuads < len(vertices)/16 { + return errors.New(fmt.Sprintf("len(quads) must be equal to or less than %d", maxQuads)) } numc := len(q.commands) for _, c := range q.commands { diff --git a/internal/graphics/program.go b/internal/graphics/program.go index 3f4aae921..5468e2168 100644 --- a/internal/graphics/program.go +++ b/internal/graphics/program.go @@ -42,7 +42,7 @@ var ( const ( indicesNum = 1 << 16 - MaxQuads = indicesNum / 6 + maxQuads = indicesNum / 6 ) // unsafe.SizeOf can't be used because unsafe doesn't work with GopherJS. @@ -94,10 +94,10 @@ func (s *openGLState) reset(context *opengl.Context) error { } const stride = 8 // (2 [vertices] + 2 [texels]) * 2 [sizeof(int16)/bytes] - s.arrayBuffer = context.NewBuffer(opengl.ArrayBuffer, 4*stride*MaxQuads, opengl.DynamicDraw) + s.arrayBuffer = context.NewBuffer(opengl.ArrayBuffer, 4*stride*maxQuads, opengl.DynamicDraw) - indices := make([]uint16, 6*MaxQuads) - for i := uint16(0); i < MaxQuads; i++ { + indices := make([]uint16, 6*maxQuads) + for i := uint16(0); i < maxQuads; i++ { indices[6*i+0] = 4*i + 0 indices[6*i+1] = 4*i + 1 indices[6*i+2] = 4*i + 2