create TextureMaterial

Software: Away3D 4.x

Avatar
TrueSign, Member
Posted: 02 February 2012 08:03 PM   Total Posts: 57

Hi,
I’m using dev branch version of away3d 4.
BitmapFileMaterial is not supported any more. BitmapMaterial has been marked as deprecated. So instead of BitmapMaterial I should use
new TextureMaterial(new BitmapTexture(bitmapData)) I can’t figure it out the formula. I used something like this:

[Embed(source="/../assets/textureDiffuse.png")]
private var PlaneTexture:Class;

var 
_mat:TextureMaterial = new TextureMaterial(new PlaneTexture(new BitmapData(256,256,false0x00FF00 ))); 

Error: undefined method BitmapData.

I have tried
var mat:TextureMaterial = new TextureMaterial(new PlaneTexture().bitmapData);
but Type Coercion failed: cannot convert flash.display::BitmapData@836d161 to away3d.textures.Texture2DBase

How can I assign a jpg or a png to material now?

   

John Brookes, Moderator
Posted: 02 February 2012 08:35 PM   Total Posts: 732   [ # 1 ]

var bitmapTexture:BitmapTexture = new BitmapTexture(new IMGAsset().bitmapData);
var mat:TextureMaterial = new TextureMaterial(bitmapTexture);

   

Avatar
TrueSign, Member
Posted: 02 February 2012 08:48 PM   Total Posts: 57   [ # 2 ]

Working Great now. Thank you very much.

   
   
‹‹ Optimal view

X

Away3D Forum

Member Login

Username

Password

Remember_me



X