I'm using the following to write text onto a texture, but having trouble on how to set the bg pixels to transparent!
Cheers
Code: Select all
ITexture* rt = driver->addRenderTargetTexture(core::dimension2d<u32>(256, 256), "rt", ECF_A8R8G8B8);
driver->setRenderTarget(rt, true, true, video::SColor(0,255,255,255));
//if(rt->hasAlpha()){
driver->draw2DRectangle(video::SColor(255, 255, 0, 0), core::recti(0, 100, 200, 200));
IGUIFont *f = env->getBuiltInFont();
f->draw(L"This is some text", rect<s32>(10, 10, 400, 300), SColor(255, 0, 0, 255), 0, 0, 0);
driver->setRenderTarget(0);
o->getMaterial(0).setTexture(0, rt);