I am trying to make objects appeared transparent when selected. The issue is that I have different objects, some textured, other not, with different kind of format for the textures.
Objects with textures having an alpha canal(png) work perfectly, but other having jpg texture or having the colors set on the vertice directly in the .egg dont became transparent.
I was wondering if there was any solution to make these object transparent.
I just want to make for example the full object half transparent.
Thank you for your answer.
I tried with pandda, and it works. I also tied with panda-model, it still works.
But when I try with my object, it doesn’t.
I searched for differences but didn’t find anything.
It’s your material. Your material is specifying a diffuse color, which hides the color specified by setColor() (including its alpha channel).
An object has multiple places in which color may be defined. Most objects just use the vertex color, and don’t have a lighting material (or if they do have a lighting material, the material doesn’t have an explicit diffuse color specified, which means it shows the vertex color).
Since your object has a material with a diffuse color, whenever lighting is enabled that diffuse color is used instead of the vertex color. That’s what a material means: use this color instead of whatever color you find on the object.
You have three choices.
(1) Instead of using setColor(), use setMaterial() to change the color, and use a material with a different color.
(2) Edit the egg file to remove the diffuse color from your material, and instead specify the color you want via entries on your vertices or polygons.
(3) At runtime, use setMaterial() to apply a material with no diffuse color specified, and then use setColor().
If your egg file was created via a model converter, it may be difficult to employ option (2).