OGRE 入门 二、Basic Tutorial 1 : An introduction to the most basic Ogre constructs

1. 下载源代码及脚本

这里有一个‘Convenient All-In-One’ 版的框架。

2. 创建场景

解压clean_ogre_cmake_project.zip,修改TutorialApplication.cpp中的函数:

 1 void TutorialApplication::createScene(void)
 2 {
 3     // create your scene here :)
 4     mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5f,0.5f,0.5f));
 5 
 6     // Create an entity
 7     Ogre::Entity* ogreHead=mSceneMgr->createEntity("Head","ogrehead.mesh");
 8 
 9     //create a sceneNode and attach the Entity to it
10     Ogre::SceneNode* headNode=mSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode");
11     headNode->attachObject(ogreHead);
12 
13 
14     //create a light and set its position
15     Ogre::Light* light=mSceneMgr->createLight("MainLight");
16     light->setPosition(20.0f,80.0f,50.0f);
17 }

3. 编译、安装、运行

cmake CMakeLists.txt
make install
dist/bin/OgreApp

运行效果如图:

原文地址:https://www.cnblogs.com/invisible/p/2800111.html