Time for action — replacing the quad with a model

Using the previous code we will now use Sinbad instead of a quad.

  1. Delete all the code for the quad; just leave the scene node creation code in place.
  2. Create an instance of Sinbad.mesh, attach it to the scene node, and use the MaterialManager to set the material of the entity to MyMaterial14:
    void createScene()
    {
    Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node1");
    Ogre::Entity* ent = mSceneMgr->createEntity("Entity1","Sinbad.mesh");
    ent->setMaterialName("MyMaterial14");
    node->attachObject(ent);
    }
    
  3. Compile and run the application; because MyMaterial14 uses the rock texture, Sinbad will be made out of rock.

What just happened?

Everything that has happened here should be ...

Get Ogre 3D 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.