Mesh Texture?

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
Cear
Posts: 45
Joined: Wed Jul 18, 2007 9:31 pm

Mesh Texture?

Post 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
beshrkayali
Posts: 85
Joined: Mon Jun 11, 2007 11:22 am
Location: Damascus - Syria
Contact:

Post by beshrkayali »

check this:

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


and then use:

->setMaterialTexture(0, driver->getTexture("home.bmp"));
Cear
Posts: 45
Joined: Wed Jul 18, 2007 9:31 pm

Post 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
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post 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.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
Cear
Posts: 45
Joined: Wed Jul 18, 2007 9:31 pm

Post 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
Post Reply