O'Reilly logo

Ogre 3D 1.7 by Felix Kerger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating a plane

Until now, we have always loaded a 3D model from a file. Now we will create one directly:

  1. Delete all the code inside the createScene() function.
  2. Add the following line to define a plane in the createScene() function:
    Ogre::Plane plane(Vector3::UNIT_Y, -10);
    
  3. Now create the plane into your memory:
    Ogre::MeshManager::getSingleton().createPlane("plane",
    ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
    1500,1500,20,20,true,1,5,5,Vector3::UNIT_Z);
    
  4. Create an instance of the plane:
    Ogre::Entity* ent = mSceneMgr->createEntity("LightPlaneEntity", "plane");
    
  5. Attach the plane to the scene:
    mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
    
  6. To get anything other than a white plane, set the material ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required