[solved]cant add texture to 3ds mesh

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
kilnan
Posts: 7
Joined: Thu Apr 02, 2009 9:42 pm

[solved]cant add texture to 3ds mesh

Post by kilnan »

Hi

I cant manage to add a texture to a model loaded from a 3ds file

I tried to do the same with an irrlicht cube and the sydney model of the example and it works..

//cubo
scene::ISceneNode* n = smgr->addCubeSceneNode();
if (n)

{

n->setMaterialTexture(0, driver->getTexture("pezzo3.tga"));
n->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
n->setMaterialFlag(video::EMF_LIGHTING, false);
}

//3ds mesh
IAnimatedMesh* n2 = smgr->getMesh("cubo.3ds");
IAnimatedMeshSceneNode* n3 = smgr->addAnimatedMeshSceneNode( n2 );

if (n3)

{

n3->setMaterialTexture(0, driver->getTexture("pezzo3.tga"));
n3->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
n3->setMaterialFlag(video::EMF_LIGHTING, false);
n3->setPosition(core::vector3df(10.0f,0.0f,10.0f));

}

as you see, I follow the same steps for both the cubeSceneNude and the imported mesh but all I get with this one is an invisible cube!
(or , if I disable the transparency,a monochromatic cube of a color which seems the sum of all the colors in the texture)
Last edited by kilnan on Fri Apr 03, 2009 11:27 am, edited 1 time in total.
kilnan
Posts: 7
Joined: Thu Apr 02, 2009 9:42 pm

Post by kilnan »

it was because the UV was not setted (maybe I had to check the faqs - omg)
Post Reply