From 25f2dfc677d09f6dbdd01b30511ef1c75509e4df Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 3 Jun 2018 01:43:10 +0900 Subject: [PATCH] graphics: Refactoring --- internal/graphics/program.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/graphics/program.go b/internal/graphics/program.go index 7e6e73439..181dfeda7 100644 --- a/internal/graphics/program.go +++ b/internal/graphics/program.go @@ -55,7 +55,7 @@ func (a *arrayBufferLayout) totalBytes() int { // newArrayBuffer creates OpenGL's buffer object for the array buffer. func (a *arrayBufferLayout) newArrayBuffer() opengl.Buffer { - return opengl.GetContext().NewArrayBuffer(a.totalBytes() * 4 * maxQuads) + return opengl.GetContext().NewArrayBuffer(a.totalBytes() * indicesNum) } // enable binds the array buffer the given program to use the array buffer. @@ -131,8 +131,9 @@ var ( ) const ( - indicesNum = 1 << 16 - maxQuads = indicesNum / 6 + indicesNum = 1 << 16 + maxTriangles = indicesNum / 3 + maxQuads = maxTriangles / 2 ) // ResetGLState resets or initializes the current OpenGL state.