From 37473d2f9f7da50e3917c211f78b1bb15c45be46 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 5 Jun 2016 03:26:00 +0900 Subject: [PATCH] graphics: Move a comment --- internal/graphics/command.go | 4 ++-- internal/graphics/framebuffer.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/graphics/command.go b/internal/graphics/command.go index 04f17cdad..f41aaf440 100644 --- a/internal/graphics/command.go +++ b/internal/graphics/command.go @@ -52,6 +52,8 @@ func (q *commandQueue) Flush(context *opengl.Context) error { if 0 < len(vertices) { context.BufferSubData(context.ArrayBuffer, vertices) } + // 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)) } @@ -97,8 +99,6 @@ func (c *drawImageCommand) Exec(context *opengl.Context) error { } context.BlendFunc(c.mode) - // 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. n := len(c.vertices) / 16 if n == 0 { return nil diff --git a/internal/graphics/framebuffer.go b/internal/graphics/framebuffer.go index 20f77394e..d1393ecaf 100644 --- a/internal/graphics/framebuffer.go +++ b/internal/graphics/framebuffer.go @@ -116,7 +116,9 @@ func (f *Framebuffer) DrawTexture(context *opengl.Context, t *Texture, vertices // Drawing a texture to the default buffer must be the last command. // TODO(hajimehoshi): This seems a little hacky. Refactor. if f.native == opengl.ZeroFramebuffer { - return theCommandQueue.Flush(context) + if err := theCommandQueue.Flush(context); err != nil { + return err + } } return nil }