Apply a texture on a 3D model

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
garwan50
Posts: 1
Joined: Sun Sep 22, 2013 5:01 pm

Apply a texture on a 3D model

Post by garwan50 »

Hello,

this is my first post in this forum, i'm new in irrlicht programation, i'm french so, sorry about grammar errors.

Code: Select all

    irr::scene::IAnimatedMesh *room = sceneManager->getMesh("room.3ds"); // Create the room
    irr::scene::IMeshSceneNode *Nroom = sceneManager->addMeshSceneNode(room->getMesh(0));
    Nroom->setMaterialFlag(irr::video::EMF_LIGHTING, true); // Unable the light sensivity
    sceneManager->getMeshManipulator()->makePlanarTextureMapping(room->getMesh(0), 0.04f); // define the number of repetition of the texture
    Nroom->setMaterialTexture( 0, driver->getTexture("rockwall.jpg") ); // Apply the texture


When i launch the "game", i have the room but it seem to be solid (black), but model and texture are correctly loaded according to the logfile.
Another question: what are the function of the second line ?

Thanks again.
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Apply a texture on a 3D model

Post by smso »

You should disable lighting for the node if no light was used:

Code: Select all

Nroom->setMaterialFlag(irr::video::EMF_LIGHTING, false);
Regards,
smso
Post Reply