Is it possible to use ETC2 texture ( as bitmap)?

Is it possible to use ETC2 texture as replacement of PNG file for 2d game ( not use display3d package, but normal sprite and bitmap ) ?
Is there will be some performance gain for such replacement ?

I don’t think it’s possible. The BitmapData class has several static methods for creating a BitmapData instance from various sources but no ETC2.

I might be wrong but I don’t think it would bring any performance gain : it’s a compression technique, useful when you want to save space.

a JPEG file will be smaller than a BMP one on disk, but once loaded in memory it’s the same.

I think using ETC2 won’t requrire decompressing in the memory which could lead to decrease of the memory allocation at RAM .
It’ll be nice if you could do some performance tests for that in OpenFL.

ETC2 is supported by OpenFL (in ATF containers), but in order to use its advantages (direct upload to video memory) you have to use the display3d.textures package. Uncompressing a compressed texture and using it as a bitmap pretty much negates all the advantages of a hardware texture, so it’ll take up exactly the same amount of RAM than using any other compression format (PNG, JPG etc).

It’s pretty easy to work with textures and tilemaps in OpenFL

1 Like

I’ve never used textures (as a bitmap replacement) before. Are there any examples of that? You mentioned tilemaps, do they also use textures?