mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
android: Bug fix: Black flicking (#226)
This commit is contained in:
parent
9757319848
commit
83a96dc532
@ -75,7 +75,6 @@ func (c *graphicsContext) Update() error {
|
||||
if IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
// TODO: In WebGL, we don't need to clear the image here.
|
||||
if err := c.defaultRenderTarget.Clear(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ func (q *commandQueue) Flush(context *opengl.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Call glFlush to prevent black flicking (especially on Android (#226)).
|
||||
context.Flush()
|
||||
q.commands = []command{}
|
||||
return nil
|
||||
}
|
||||
@ -103,7 +105,6 @@ func (c *drawImageCommand) Exec(context *opengl.Context) error {
|
||||
if n == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
p := programContext{
|
||||
state: &theOpenGLState,
|
||||
program: theOpenGLState.programTexture,
|
||||
|
@ -454,3 +454,10 @@ func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (c *Context) Flush() {
|
||||
c.RunOnContextThread(func() error {
|
||||
gl.Flush()
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
@ -370,3 +370,8 @@ func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) {
|
||||
gl := c.gl
|
||||
gl.DrawElements(int(mode), len, gl.UNSIGNED_SHORT, offsetInBytes)
|
||||
}
|
||||
|
||||
func (c *Context) Flush() {
|
||||
gl := c.gl
|
||||
gl.Flush()
|
||||
}
|
||||
|
@ -373,3 +373,8 @@ func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) {
|
||||
gl := c.gl
|
||||
gl.DrawElements(mgl.Enum(mode), len, mgl.UNSIGNED_SHORT, offsetInBytes)
|
||||
}
|
||||
|
||||
func (c *Context) Flush() {
|
||||
gl := c.gl
|
||||
gl.Flush()
|
||||
}
|
||||
|
@ -44,8 +44,12 @@ loop:
|
||||
return err
|
||||
case <-worker.WorkAvailable():
|
||||
worker.DoWork()
|
||||
case <-chRenderEnd:
|
||||
break loop
|
||||
default:
|
||||
select {
|
||||
case <-chRenderEnd:
|
||||
break loop
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user