Page 1 of 1

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

Posted: Tue Sep 19, 2006 1:30 am
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

Posted: Tue Sep 19, 2006 7:17 am
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?

Posted: Tue Sep 19, 2006 1:43 pm
by keithwei
image has been uploaded .
need your help,3ks.

Posted: Tue Sep 19, 2006 3:25 pm
by hybrid
Did you change the material type to one supporting alpha textures? Otherwise only RGB is rendered.

Posted: Wed Sep 20, 2006 1:51 am
by keithwei
I had been try all of EMT ,but no effect to show the png image

Posted: Wed Sep 20, 2006 9:02 am
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.

Posted: Thu Sep 21, 2006 1:06 am
by keithwei
Thanks,the problem has been resolved throught your help.I changed the MaterialTypeParam value.