HI, Here is a detail of what i am doin …
[code] le = new Texture2D(context_);
//dyamic tex 640x480 with alpha
le->SetSize(640, 480, Graphics::GetRGBAFormat(),TEXTURE_DYNAMIC);
// A Image container for frame buffer
ipic = new Image(context_);
//resized internal buffer to 640 x 480
ipic->SetSize(640, 480, 4);
//white opaque
memset(ipic->GetData(), 0xff, 640*480*4);
//set data
le->SetData(ipic,true);
UI* ui = GetSubsystem<UI>();
dynamic_sprite = ui->GetRoot()->CreateChild<Sprite>();
// Set logo sprite texture
dynamic_sprite->SetTexture(le);
int textureWidth = le->GetWidth();
int textureHeight = le->GetHeight();
// Set logo sprite size
dynamic_sprite->SetSize(textureWidth, textureHeight);
// Set logo sprite hot spot
dynamic_sprite->SetHotSpot(0, textureHeight);
// Set logo sprite alignment
dynamic_sprite->SetAlignment(HA_CENTER, VA_BOTTOM);
[/code]
This all works, now I am tryin to update it runtime,
[code] unsigned char* dat = ipic->GetData();
for (int i=0; i<widthheight; i++) {
dat[4i] = 0xff; // RED
dat[4i + 1] = 0;
dat[4i + 2] = 0;
dat[4*i + 3] = 128; //ALPHA
//alpha is 128 ie half transparent, but it is opaque, if set to "0" it becomes completely transparent
// I require alpha mapped sprite
}
le->SetData(ipic);
[/code]
[color=#FF0000]//alpha is 128 ie half transparent, but it is seen opaque, if set to "0" it becomes completely transparent
// I require alpha mapped sprite[/color]
is it possible in URHO3D ?