mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
graphics: Bug fix: glTexSubImage2D on Android now works (#211)
This commit is contained in:
parent
1b152ae771
commit
0c611d875b
2
image.go
2
image.go
@ -182,8 +182,6 @@ func (i *Image) Dispose() error {
|
|||||||
// This function may be slow (as for implementation, this calls glTexSubImage2D).
|
// This function may be slow (as for implementation, this calls glTexSubImage2D).
|
||||||
//
|
//
|
||||||
// This function is concurrent-safe.
|
// This function is concurrent-safe.
|
||||||
//
|
|
||||||
// BUG(hajimehoshi) ReplacePixels might not work on Android (#211).
|
|
||||||
func (i *Image) ReplacePixels(p []uint8) error {
|
func (i *Image) ReplacePixels(p []uint8) error {
|
||||||
return i.impl.ReplacePixels(p)
|
return i.impl.ReplacePixels(p)
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,10 @@ func (c *replacePixelsCommand) Exec(context *opengl.Context) error {
|
|||||||
if err := context.FillFramebuffer(0, 0, 0.5, 1); err != nil {
|
if err := context.FillFramebuffer(0, 0, 0.5, 1); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// This is necessary on Android. We can't call glClear just before glTexSubImage2D without
|
||||||
|
// glFlush. glTexSubImage2D didn't work without this hack at least on Nexus 5x (#211).
|
||||||
|
// TODO: Can we have a better way like optimizing commands?
|
||||||
|
context.Flush()
|
||||||
context.BindTexture(c.dst.texture.native)
|
context.BindTexture(c.dst.texture.native)
|
||||||
context.TexSubImage2D(c.pixels, c.dst.width, c.dst.height)
|
context.TexSubImage2D(c.pixels, c.dst.width, c.dst.height)
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user