graphics: Refactoring

This commit is contained in:
Hajime Hoshi 2018-06-03 01:43:10 +09:00
parent 03e3f0f5f7
commit 25f2dfc677

View File

@ -55,7 +55,7 @@ func (a *arrayBufferLayout) totalBytes() int {
// newArrayBuffer creates OpenGL's buffer object for the array buffer. // newArrayBuffer creates OpenGL's buffer object for the array buffer.
func (a *arrayBufferLayout) newArrayBuffer() opengl.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. // enable binds the array buffer the given program to use the array buffer.
@ -131,8 +131,9 @@ var (
) )
const ( const (
indicesNum = 1 << 16 indicesNum = 1 << 16
maxQuads = indicesNum / 6 maxTriangles = indicesNum / 3
maxQuads = maxTriangles / 2
) )
// ResetGLState resets or initializes the current OpenGL state. // ResetGLState resets or initializes the current OpenGL state.