examples/contextlost: Extend the shared backend texture on purpose

This commit is contained in:
Hajime Hoshi 2018-03-19 03:16:52 +09:00
parent 96b9f09058
commit c6cd672536

View File

@ -40,6 +40,7 @@ const (
var ( var (
count = 0 count = 0
gophersImage *ebiten.Image gophersImage *ebiten.Image
extraImages []*ebiten.Image
) )
func update(screen *ebiten.Image) error { func update(screen *ebiten.Image) error {
@ -86,6 +87,12 @@ func main() {
} }
gophersImage, _ = ebiten.NewImageFromImage(img, ebiten.FilterDefault) gophersImage, _ = ebiten.NewImageFromImage(img, ebiten.FilterDefault)
// Extend the shared backend GL texture on purpose.
for i := 0; i < 20; i++ {
eimg, _ := ebiten.NewImageFromImage(img, ebiten.FilterDefault)
extraImages = append(extraImages, eimg)
}
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Context Lost (Ebiten Demo)"); err != nil { if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Context Lost (Ebiten Demo)"); err != nil {
log.Fatal(err) log.Fatal(err)
} }