graphics: Move a comment

This commit is contained in:
Hajime Hoshi 2016-06-05 03:26:00 +09:00
parent aa83167e56
commit 37473d2f9f
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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
}