Time for action — starting Ogre 3D

This time we are working on a blank sheet.

  1. Start with an empty code file, include Ogre3d.h, and create an empty main function:
    #include "Ogre\Ogre.h"
    int main (void)
    {
    return 0;
    }
    
  2. Create an instance of the Ogre 3D Root class; this class needs the name of the "plugin.cfg":
    Ogre::Root* root = new Ogre::Root("plugins_d.cfg");
    
  3. If the config dialog can't be shown or the user cancels it, close the application:
    if(!root->showConfigDialog())
    {
    return -1;
    }
    
  4. Create a render window:
    Ogre::RenderWindow* window = root->initialise(true,"Ogre3D Beginners Guide");
    
  5. Next create a new scene manager:
    Ogre::SceneManager* sceneManager = root->createSceneManager(Ogre::ST_GENERIC);
    
  6. Create a camera and name it camera:
    Ogre::Camera* camera = ...

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.