trying to use Transparency but with no success

i have a textue with alpha channel (i tried bmp,tga and png).

i used the following code:
//first approach:texture is a NodePath:

texture = window->load_model(framework.get_models(),mydir+"/plane.egg.pz");
texture.reparent_to(window->get_render_2d());

PT(TextureStage) ts = new TextureStage(“ts”);
ts->set_mode(TextureStage::M_decal);
Texture *a = TexturePool::load_texture(mydir+"/button.bmp");
texture.set_texture(a);
//not working with or without this line:
texture.set_transparency(TransparencyAttrib::M_alpha);

//second approach: card is NodePath as well:
//cm is the card generator

cm.set_frame_fullscreen_quad(); 
card = window->get_render_2d().attach_new_node(cm.generate());


card.set_texture(a);
card.set_transparency(TransparencyAttrib::M_alpha);
card.set_scale(0.1);

thank you all.

Hi

Check out this other post:
[url][SOLVED]RGBA pngs and setTransparency() - model is invisible]

They may be working on a similar problem as yours…

I don’t see anything obviously wrong with your code, though I don’t know precisely what’s going wrong or what you expect to happen. Note that alpha is not supported by our bmp and tga loader, but it is supported by png. However, Photoshop sometimes writes an additional png channel which confuses the alpha channel, so you do have to be careful there. Try using GIMP to verify that the png alpha channel is written correctly; or simply load the png file in pview with the command line “pview button.png”. You should see gray (the window background color) where the alpha values are 0.

David