i'm trying to create a 3d-user interface. however, starting with the basics I want to create round circular widgets. to keep it simple I put a circle image texture on a testscenenode (simple cube mesh) and make the corners transparent.
well, and thats the problem. i don't get it to be transparent.
plz take a look at the following code snippet:
Code: Select all
scene::ISceneNode* widget = smgr->addBillboardSceneNode(0,core::dimension2d<f32>(1.0f,1.0f),core::vector3df(0.0f,0.0f,-1.0f),-1);
//scene::ISceneNode* widget = smgr->addBillboardSceneNode(0,core::dimension2d<f32>(1.0f,1.0f),core::vector3df(0.0f,0.0f,-1.0f),-1);
//device->getVideoDriver()->setTextureCreationFlag(video::ETCF_ALWAYS_16_BIT, true);
video::ITexture* wgtex = driver->getTexture("../../media/circle.bmp");
driver->makeColorKeyTexture(wgtex, core::position2d<s32>(0,0));
widget->setMaterialTexture(0, wgtex);
widget->setMaterialFlag(video::EMF_LIGHTING, false);
widget->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
//widget->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
//widget->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
the only transparent effect I get, is when the corners of the circle are dark and I choose EMT_TRANSPARENT_ALPHA_CHANNEL_REF. This is unacceptable as I need dark colours for UI design. EMT_TRANSPARENCY_ADD_COLOR works as well, but I need bright colour to be solid as well. with EMT_TRANSPARENT_ALPHA_CHANNEL the whole texture is invisible. All this is independent of the use of makeColorKeyTexture which as no effect at all.
Other options I tried: orthogonal projection vs perspective, billboardscenenode instead of testscenenode.
erm, please help me!
best regards,
warden