Transparent image GUI button

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
tumitoto007

Transparent image GUI button

Post by tumitoto007 »

I am looking for any pointers can help me create transparent image buttons with IRRLICHT engine, any help will be appreciated. thanks in advance.
Mr_Ridd
Posts: 63
Joined: Tue Sep 28, 2004 5:16 am

Post by Mr_Ridd »

Hey

From the MeshViewer tut:

for (s32 i=0; i<gui::EGDC_COUNT ; ++i)
{
video::SColor col = env->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i);
col.setAlpha(255);
env->getSkin()->setColor((gui::EGUI_DEFAULT_COLOR)i, col);
}

This sets ths alpha of the skin. I haven't looked into it but this makes the whole gui transparent.
tumitoto
Posts: 3
Joined: Fri Sep 17, 2004 2:49 am

Post by tumitoto »

Hi, thanks for the reply.
My question is..when i create a gui button i can use:

IGUIButton (IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle)

then I can use the setImage method to get an image into this button:

setImage (video::ITexture *image)

But I can not find any method in ITexture to set the background color to transparent...anyone got this figured out? thanks in advance.
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

You load the texture with:

ITexture* texture = driver->getTexture();

then do:

driver->makeColorKeyTexture();

to make a color transparant (check api for correct syntax and use).
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
tumitoto007

Post by tumitoto007 »

Got it, thanks a bunch!!
Post Reply