mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
parent
c2eae69b47
commit
8c54cf639a
@ -32,6 +32,9 @@ func Get() *Driver {
|
|||||||
type Driver struct {
|
type Driver struct {
|
||||||
state openGLState
|
state openGLState
|
||||||
context context
|
context context
|
||||||
|
|
||||||
|
// drawCalled is true just after Draw is called. This holds true until ReplacePixels is called.
|
||||||
|
drawCalled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) SetThread(thread *thread.Thread) {
|
func (d *Driver) SetThread(thread *thread.Thread) {
|
||||||
@ -108,6 +111,7 @@ func (d *Driver) SetVertices(vertices []float32, indices []uint16) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) Draw(indexLen int, indexOffset int, mode driver.CompositeMode, colorM *affine.ColorM, filter driver.Filter, address driver.Address) error {
|
func (d *Driver) Draw(indexLen int, indexOffset int, mode driver.CompositeMode, colorM *affine.ColorM, filter driver.Filter, address driver.Address) error {
|
||||||
|
d.drawCalled = true
|
||||||
if err := d.useProgram(mode, colorM, filter, address); err != nil {
|
if err := d.useProgram(mode, colorM, filter, address); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,10 @@ func (i *Image) ReplacePixels(p []byte, x, y, width, height int) {
|
|||||||
|
|
||||||
// glFlush is necessary on Android.
|
// glFlush is necessary on Android.
|
||||||
// glTexSubImage2D didn't work without this hack at least on Nexus 5x and NuAns NEO [Reloaded] (#211).
|
// glTexSubImage2D didn't work without this hack at least on Nexus 5x and NuAns NEO [Reloaded] (#211).
|
||||||
i.driver.context.flush()
|
if i.driver.drawCalled {
|
||||||
|
i.driver.context.flush()
|
||||||
|
}
|
||||||
|
i.driver.drawCalled = false
|
||||||
i.driver.context.texSubImage2D(i.textureNative, p, x, y, width, height)
|
i.driver.context.texSubImage2D(i.textureNative, p, x, y, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user