what's wrong in loading a png image as mesh texture [SOLVED]

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
keithwei
Posts: 10
Joined: Fri Sep 09, 2005 6:36 am

what's wrong in loading a png image as mesh texture [SOLVED]

Post by keithwei »

when i use

Code: Select all

draw2DImage(driver->getTexture("c:\\image.png"), position2di(x, y), SourceRect, 0, SColor(255, 255, 255), true); 
to draw the png image.the image is my need.
Image
then I want to display a png image as a mesh texture.
so i write

Code: Select all

node->setMaterialTexture(0,driver->getTexture("c:\\image.png"));
but i get a different color image texture.
Image
how can i get the correct png image as a mesh texture?
Thanks
Last edited by keithwei on Tue Sep 19, 2006 1:41 pm, edited 3 times in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It would help to see the different colors. So please upload screenshots somewhere (e.g. sourceforge bug tracker). Maybe it's just a missing lighting disable?
keithwei
Posts: 10
Joined: Fri Sep 09, 2005 6:36 am

Post by keithwei »

image has been uploaded .
need your help,3ks.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Did you change the material type to one supporting alpha textures? Otherwise only RGB is rendered.
keithwei
Posts: 10
Joined: Fri Sep 09, 2005 6:36 am

Post by keithwei »

I had been try all of EMT ,but no effect to show the png image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

EMT_TRANSPARENT_ALPHA_CHANNEL is the one you want. But since your png alpha channel only has values <=127 the default settings won't render the image at all. You have to set MaterialTypeParam to 0.001f or something like that.
keithwei
Posts: 10
Joined: Fri Sep 09, 2005 6:36 am

Post by keithwei »

Thanks,the problem has been resolved throught your help.I changed the MaterialTypeParam value.
Post Reply