Page 1 of 1

Mesh Texture?

Posted: Mon Jul 23, 2007 7:09 am
by Cear
I have my sky box, terrain, and .x mesh loaded. and yay i have figured out how to rotate it to its upright position.

but its black. pitch black.
How am i supposed to load the textue onto the mesh? and will it be the say way a uv mapped it in 3dstudio max?
I make al of my meshes in 3d studio. And i cant seem to export them into my game without them being black!

heres my code

Code: Select all

device->getFileSystem()->addZipFileArchive("home.x");
scene::IAnimatedMesh* mesh = smgr->getMesh("home.x");

scene::ISceneNode* node = 0;

if (mesh)
    node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
    
    if (node)
    node->setPosition(core::vector3df(150,3,50));
    node->setRotation(core::vector3df(0,0,0));
and i even added

node->setMaterialTexture(0, driver->getTexture("home.bmp"));

in there but it diddnt do anything but say it loaded the texture in the dos box

Posted: Mon Jul 23, 2007 7:21 am
by beshrkayali
check this:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=23052


and then use:

->setMaterialTexture(0, driver->getTexture("home.bmp"));

Posted: Mon Jul 23, 2007 8:27 am
by Cear
hey man thanks alot for all you healp. i just compiled your way to load mesh's an its grandole however

Code: Select all

scene::IMesh* home_mesh = smgr->getMesh("home.3ds")->getMesh(0);; 

scene::ISceneNode* home_node = smgr->addMeshSceneNode(home_mesh); 

if (home_node) 
   home_node->setPosition(core::vector3df(1700,2,4000));
   home_node->setRotation(core::vector3df(0,180,0));
   home_node->setMaterialTexture(0, driver->getTexture("home.bmp"));
scene::ISceneNode* node = 0;

this complies but doesnt help my load the texture. it is helps you at all
all im trying do to is load the IRREDIT house into my scene.
i wish i could get full IRR EDIT .irr scenes to load but they come out all mest up.

if i could jsut get some texture on this house it would brighten up my day!

thanks again man

Posted: Mon Jul 23, 2007 10:05 am
by Virion
1. Open your irr file with wordpad.
2. Check and see if your textures are linked correctly to the respective directories.
3. If it's not, edit it on the spot with wordpad, and save.

Good luck.

Posted: Mon Jul 23, 2007 10:22 am
by JP
Set lighting to false on the mesh and it should display properly. It's black because you have it set to use the lights in your scene to illuminate it but presumably you've not actually got any lights and so it turns out black.

Do something like node->setMaterialFlag(EMF::LIGHTING, false);

Check the API for the correct code as i can't remember it off the top of my head.

Posted: Mon Jul 23, 2007 4:38 pm
by Cear
JP and Virion thank, both of your suggestions worked. i had no idea .irr would open in a text editor now i have it pull everything right from my games directory.

for my current set up

home_node->setMaterialFlag(EMF::LIGHTING, false);

put it all to work.

i should have known it had something to do with lighting.
if einstien started writing code today i bet hed feel as dumb as i do sometimes. thats the great thing about it