This time we are working on a blank sheet.
Start with an empty code file, include
Ogre3d.h
, and create an empty main function:#include "Ogre\Ogre.h" int main (void) { return 0; }
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");
If the config dialog can't be shown or the user cancels it, close the application:
if(!root->showConfigDialog()) { return -1; }
Create a render window:
Ogre::RenderWindow* window = root->initialise(true,"Ogre3D Beginners Guide");
Next create a new scene manager:
Ogre::SceneManager* sceneManager = root->createSceneManager(Ogre::ST_GENERIC);
Create a camera and name it
camera:
Ogre::Camera* camera = sceneManager->createCamera("Camera"); camera->setPosition(Ogre::Vector3(0,0,50)); camera->lookAt(Ogre::Vector3(0,0,0)); camera->setNearClipDistance(5);
With this camera, create a
viewport
and set the background color to black...