mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +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() {
|
if IsRunningSlowly() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// TODO: In WebGL, we don't need to clear the image here.
|
|
||||||
if err := c.defaultRenderTarget.Clear(); err != nil {
|
if err := c.defaultRenderTarget.Clear(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,8 @@ func (q *commandQueue) Flush(context *opengl.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Call glFlush to prevent black flicking (especially on Android (#226)).
|
||||||
|
context.Flush()
|
||||||
q.commands = []command{}
|
q.commands = []command{}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -103,7 +105,6 @@ func (c *drawImageCommand) Exec(context *opengl.Context) error {
|
|||||||
if n == 0 {
|
if n == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
p := programContext{
|
p := programContext{
|
||||||
state: &theOpenGLState,
|
state: &theOpenGLState,
|
||||||
program: theOpenGLState.programTexture,
|
program: theOpenGLState.programTexture,
|
||||||
|
@ -454,3 +454,10 @@ func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) {
|
|||||||
return nil
|
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 := c.gl
|
||||||
gl.DrawElements(int(mode), len, gl.UNSIGNED_SHORT, offsetInBytes)
|
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 := c.gl
|
||||||
gl.DrawElements(mgl.Enum(mode), len, mgl.UNSIGNED_SHORT, offsetInBytes)
|
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
|
return err
|
||||||
case <-worker.WorkAvailable():
|
case <-worker.WorkAvailable():
|
||||||
worker.DoWork()
|
worker.DoWork()
|
||||||
case <-chRenderEnd:
|
default:
|
||||||
break loop
|
select {
|
||||||
|
case <-chRenderEnd:
|
||||||
|
break loop
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user