From 5e93d75ae0627d67c39ac0878ccee230ee784179 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 28 May 2018 00:49:16 +0900 Subject: [PATCH] graphics: Fix comments --- internal/graphics/command.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/graphics/command.go b/internal/graphics/command.go index 67cd56d26..523cb9227 100644 --- a/internal/graphics/command.go +++ b/internal/graphics/command.go @@ -142,7 +142,8 @@ func (q *commandQueue) Flush() error { // See BufferSubData in context_mobile.go. opengl.GetContext().BufferSubData(opengl.ArrayBuffer, q.vertices[lastN:n]) } - // NOTE: WebGL doesn't seem to have Check gl.MAX_ELEMENTS_VERTICES or gl.MAX_ELEMENTS_INDICES so far. + // NOTE: WebGL doesn't seem to have 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 < (n-lastN)*opengl.Float.SizeInBytes()/QuadVertexSizeInBytes() { return fmt.Errorf("len(quads) must be equal to or less than %d", maxQuads) @@ -154,6 +155,9 @@ func (q *commandQueue) Flush() error { return err } n := c.NumVertices() * opengl.Float.SizeInBytes() / QuadVertexSizeInBytes() + // TODO: indexOffsetInBytes should be reset if the command type is different + // from the previous one. This fix is needed when another drawing command is + // introduced than drawImageCommand. indexOffsetInBytes += 6 * n * 2 } if 0 < numc { @@ -203,8 +207,6 @@ func (c *drawImageCommand) Exec(indexOffsetInBytes int) error { } proj := f.projectionMatrix() theOpenGLState.useProgram(proj, c.src.texture.native, c.dst, c.src, c.color, c.filter) - // TODO: We should call glBindBuffer here? - // The buffer is already bound at begin() but it is counterintuitive. opengl.GetContext().DrawElements(opengl.Triangles, 6*n, indexOffsetInBytes) // glFlush() might be necessary at least on MacBook Pro (a smilar problem at #419),