Hi
I ran into an issue recently. While compressed textures can be perfectly displayed with Texture.uploadCompressedTextureFromByteArray() and BitmapData.fromTexture(), I’m not able to copy the once rendered texture to another BitmapData.
I tried the followings:
- new BitmapData(), BitmapData.copyPixels() is empty and additionally the BitmapData is rendered on Canvas (should be WebGL I think)
- If I create an empty Texture and a BitmapData from that Texture first and copy from the original BitmapData to this new instance, the BitmapData is still empty
- Tileset, Tilemap also produce empty results for Compressed Textures.
Is there any way to effectively and successfully copy compressed textures to another texture or bitmapdata? I’m trying to use texture atlases and I’m not able to create multiple display objects based on a single texture because of this issue.
Code:
tex2 = context.createTexture(4096, 2048, Context3DTextureFormat.COMPRESSED_ALPHA, false);
tex2.uploadCompressedTextureFromByteArray( atf2, 0 );
bmpd2 = BitmapData.fromTexture( tex2 );
bmp2 = new Bitmap( bmpd2 );
this.addChild( bmp2 ); // success
text4 = context.createTexture(4096, 2048, Context3DTextureFormat.COMPRESSED_ALPHA, false);
// note the empty texture
bmpd4 = BitmapData.fromTexture( text4 );
bmpd4.copyPixels( bmpd2, bmpRect, new Point( 0, 0 ), null, null, true );
bmp4 = new Bitmap( bmpd4 );
this.addChild( bmp4); // fail, the BitmapData is empty
ts = new Tileset( bmpd2, [ bmpRect ] );
tm = new Tilemap( 4096, 2048, ts );
this.addChild( tm ); // this also produces an empty object
Thank you