How to update/draw on BitmapData from TextureMaterial?

Software: Away3D 4.x

Vice, Member
Posted: 18 March 2012 01:43 PM   Total Posts: 58

hi.
i try to draw on texture bitmapData after assign it to a material. but the bitmapData don’t update. So is there a way to modify the textures bitmaData?

thanks!

   

Ontheronix, Jr. Member
Posted: 18 March 2012 02:32 PM   Total Posts: 37   [ # 1 ]

Same question here smile
Can you post your code?

   

Vice, Member
Posted: 18 March 2012 02:59 PM   Total Posts: 58   [ # 2 ]

Okay, i ve got it - it’s pretty easy:

var bitmapData :  BitmapData = new BitmapData(512, 512);
bitmapTexture = new BitmapTexture(bitmapData);   
yourMaterial = new TextureMaterial(bitmapTexture);

//now, your able to do any updates like this:


//draw something into e.g. a Sprite or whatever
var spr : Sprite = new Sprite();
...
testBitmapData = new BitmapData(512, 512);
testBitmapData.draw(spr);
bitmapTexture.bitmapData = testBitmapData;

i try to draw into “bitmapTexture.bitmapData” thats not possible. and i don’t know why.

   

Ontheronix, Jr. Member
Posted: 26 March 2012 04:56 PM   Total Posts: 37   [ # 3 ]

Has this been resolved in any way?

   

Avatar
Baush, Sr. Member
Posted: 27 March 2012 01:15 AM   Total Posts: 135   [ # 4 ]

I can update mine the same way:

var bm:BitmapData = bitmapTexture.bitmapData.clone();
bm.fillRect(bm.rect, 0x000000);
bitmapTexture.bitmapData = bm;

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X