How to make font semi-transparent with Irrlicht?

I'm having trouble drawing a font with an alpha channel:

gui::IGUIFont* font = device->getGUIEnvironment()->getBuiltInFont();

font->draw(L"C'mon, be transparent, PLEASE!!!",
           core::rect<s32>(130,10,300,50),
           video::SColor(127,255,255,255));

As you can see, the text should have an alpha value of 127... but it doesn't.

How can I draw transparent text?

Answers


I found out that if I use SOFTWARE driver instead of OPEN_GL or DirectX, I also get your problem. But with OpenGL or DirectX it works fine. So if it is an option you can one of these drivers below:

video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;
video::E_DRIVER_TYPE driverType = video::video::EDT_DIRECT3D8;
video::E_DRIVER_TYPE driverType = video::video::EDT_DIRECT3D9;

Solution is simple. Use StaticText. Just like this:

m_pText = m_pGUIEnvironment->addStaticText(
    "C'mon, be transparent, PLEASE!!!",
    rect<s32>(130,10,300,50)
);
// Set your desired color with alpha value as OVERRIDE one.
m_pText->setOverrideColor(SColor(127,0,0,0));
// And don't forget to enable it!
m_pText->enableOverrideColor(true);

Voela, now you have semi-transparent text. By the way, I also think that you were trying to use a white-colored text within white environment. Look at your color - transparency is useless as long as you don't use different colors for text and background. In any case, try using my example, if everything else fails.


Need Your Help

ASP.NET Repeater template sub-control visibility before databind

asp.net repeater findcontrol

I have a custom control which contains a Repeater control. The Repeater has an ItemTemplate. Inside that item template I have a panel which is going to hide something based on "IsEditable" a boolean

Displaying JSON from an API in and HTML table using PHP

php html json

I realize there is likely something very easy I'm missing here. Also, I'm very new to php so please keep that in mind when responding :)