OpenFL, Android, Tilesheet.drawTiles: .png rendered as black

Hey guys!

I’m using a .png spritesheet which has a PoT size - 1024x512. To draw sprites I’m calling openfl.display.Tilesheet.drawTiles. It works as expected on flash and windows, but on Android (at least via BlueStacks) non-transparent pixels are black.

I’m really confused because googling reveals two similar at first glance problems:

  1. transparent pixels are black - not my case;
  2. non-transparent or maybe even all pixels are black, but in case of a NPoT image size - not my case either.

Please help!

$ haxelib list
actuate: 1.8.2 1.8.3 [1.8.4]
box2d: [1.2.3]
haxeui: 1.7.0 [1.7.12]
hscript: [2.0.4]
hxcpp: 3.1.68 [3.2.81]
layout: [1.2.0]
lime-samples: [2.3.0]
lime: 2.1.2 2.3.1 [2.3.3]
openfl-samples: [2.2.2]
openfl: 2.2.7 3.0.1 [3.0.3]
svg: [1.0.8]
swf: 1.7.7 [1.8.4]
yagp: [1.1.4]

Possibly related to All images are black in android ?
Does it work in legacy mode?

I’m getting black tiles on v2 and nothing is drawn on legacy when I try to use drawTiles :frowning:

I added <set name="openfl-legacy" /> to project.xml and now I see an empty black screen. Seems like I’m having the same issue as Fernando. Is there maybe some extra information I could provide to ease debugging? Thanks for your time.

Sorry, guys! lime test android -Dlegacy has resolved this issue. Your replies and this article were really helpful.

Posting in this thread as i’m seeing exectly the same behaviour with the latest openfl/lime using tilesheets on Android (other targets which can use Tilesheets fine).

Pixels with alpha are drawn correctly, pixels without alpha are black - This is occuring on Android target only.

For my current project, I see lots of outlines of things, e.g. my white text is black text with which outlines where alpha exists. similarly with other visible objects

To confirm exactly whats going on - when i re save my tilesheet.png with opacity set to 254/255 (i.e. giving every pixel a tiny bit of alpha) every pixel is drawn correctly !

Hi guys,

I encountered similar problem when using Tilesheet on android. But in my case, both transparent and non transparent pixel are rendered black when run on android. I have tried both legacy and v2, but the problem persist. I wonder if I missing something…

Here’s my screenshot.

Any help would be really appreciated. Thank you.

How big is your tile sheet?

my tilesheet is only 240x210

Just curious,

Try making your tilesheet a power of 2 size, like 256 x 256, see if that makes a difference

1 Like

Sorry for my late reply!
@singmajesty its rendered correctly when tilesheet size is power of 2, thanks for the suggestion.