在Ubuntu 12.04上搭建OGRE的开发环境使用命令:
sudo apt-get install libogre-dev
#include "OGRE/ExampleApplication.h"
class Example1 : public ExampleApplication
{
public:
void createScene()
{
//Set the scene's ambient light
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5f,0.5f,0.5f));
//Create an Entity
Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head","ogrehead.mesh");
//Create a SceneNode and attach to Entity to it
Ogre::SceneNode *headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode");
headNode->attachObject(ogreHead);
//Create a Light and set its position
Ogre::Light *light = mSceneMgr->createLight("MainLight");
light->setPosition(20,80,50);
}
};
int main(int argc, char *argv[])
{
Example1 app;
app.go();
return 0;
}g++ -o app main.cpp `pkg-config --libs OGRE OIS`
所有代码上传到github上:
https://github.com/chaiwizard/learn_ogre
原文:http://blog.csdn.net/bizzareblizzard/article/details/44591437