graphics: Revert FlushCommand execution

This commit is contained in:
Hajime Hoshi 2016-06-11 20:21:14 +09:00
parent f322aaec02
commit dfd4bc89ed
3 changed files with 8 additions and 3 deletions

View File

@ -84,7 +84,6 @@ func (c *graphicsContext) Update() error {
if err := c.defaultRenderTarget.DrawImage(c.screen, options); err != nil {
return err
}
graphics.FlushCommands(ui.GLContext())
// Call glFlush to prevent black flicking (especially on Android (#226)).
ui.GLContext().Flush()
return nil

View File

@ -261,7 +261,7 @@ func (i *imageImpl) DrawImage(image *Image, options *DrawImageOptions) error {
geom := &options.GeoM
colorm := &options.ColorM
mode := opengl.CompositeMode(options.CompositeMode)
if err := i.framebuffer.DrawTexture(image.impl.texture, vertices[:16*n], geom, colorm, mode); err != nil {
if err := i.framebuffer.DrawTexture(ui.GLContext(), image.impl.texture, vertices[:16*n], geom, colorm, mode); err != nil {
return err
}
return nil

View File

@ -105,7 +105,7 @@ func (f *Framebuffer) Fill(clr color.Color) error {
return nil
}
func (f *Framebuffer) DrawTexture(t *Texture, vertices []int16, geo, clr Matrix, mode opengl.CompositeMode) error {
func (f *Framebuffer) DrawTexture(context *opengl.Context, t *Texture, vertices []int16, geo, clr Matrix, mode opengl.CompositeMode) error {
c := &drawImageCommand{
dst: f,
src: t,
@ -115,6 +115,12 @@ func (f *Framebuffer) DrawTexture(t *Texture, vertices []int16, geo, clr Matrix,
mode: mode,
}
theCommandQueue.Enqueue(c)
// TODO: Can we move this to graphicscontext.go (again)?
if f.native == opengl.ZeroFramebuffer {
if err := FlushCommands(context); err != nil {
return err
}
}
return nil
}