This first Lab assignment is intended to get the Ogre3D environment started. Getting the development environment set up and configured can be a little tricky for the first time, so this Lab will be solely used to get the “Hello World” of Ogre3D built.
There will be a pdf guide that will take you through the basic application step by step. I strongly encourage you to try to understand the steps not just writing it down like a zombie parrot, as the follow up Labs will all be built on top of the base you create in Lab 1.
Discussion thread for this lab will be on Piazza: Lab 1 Discussion Thread. Please don't hesitate to ask questions or comment on the Lab assignment.
- Download and install C++ development environment, the instructions will assume you are using the MS Visual C++ Express 2010 environment, which you can get for free. You're free to use other environments or platforms as long as you take care of making it work on your own (with the help of the Internet).
To prepare your environment and project you need to:
example: C:\Ogre1.9_vc100\OgreSDK_vc10_v1-9-0
WIN32 Console Application
and completely empty. You will write it from scratch.properties
. Add Ogre folders and files in several locations within the properties:$(ProjectName)\
at the end of the output directory so it will look like:$(SolutionDir)$(Configuration)\$(ProjectName)\
$(OGRE_HOME)\include\OIS;$(OGRE_HOME)\include\OGRE;$(OGRE_HOME)\include;$(OGRE_HOME)\boost;%(AdditionalIncludeDirectories)
Note:
OgreMain_d.lib;OIS_d.lib;%(AdditionalDependencies)
Note:
$(OGRE_HOME)\boost\lib;$(OGRE_HOME)\lib\debug;%(AdditionalLibraryDirectories)
Project Configuration->General->Platform Toolset = Visual Studio 2010 (v100)
Note:
Note:
FileSystem=../../OgreSDK_vc10_v1-9-0/media/materials/programs
FileSystem=C:/Ogre1.9_vc100/OgreSDK_vc10_v1-9-0/media/materials/programs
You should now follow the guide from “Ogre3D 1.7 Beginners Guide by Felix Kerger” which you can get Here.
For this Lab we will only do the sections 1 - 3 of the Ogre 3D beginners Guide. The rest will be covered in the next Lab assignment.
The first 2 labs will be following this guide and getting familiar with the Ogre3D environment.
Note:
sceneManager->setAmbientLight(Ogre::ColourValue(0.3f, 0.3f, 0.3f));
Your final results should look something like this:
#include "OGRE/Ogre.h" int main() { Ogre::Root* root = new Ogre::Root("plugins_d.cfg"); if(!root->showConfigDialog()) { return -1; } Ogre::RenderWindow* window = root->initialise(true, "Ogre3D Beginners Guide"); Ogre::SceneManager* sceneManager = root->createSceneManager(Ogre::ST_GENERIC); Ogre::Camera* camera = sceneManager->createCamera("Camera"); camera->setPosition(Ogre::Vector3(0,0,30)); camera->lookAt(Ogre::Vector3(0,0,0)); camera->setNearClipDistance(5); Ogre::Viewport* viewport = window->addViewport(camera); viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0)); camera->setAspectRatio(Ogre::Real(viewport->getActualWidth())/Ogre::Real(viewport->getActualHeight())); //Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Ogre SDK/OgreSDK_vc10_v1-8-1/media/packs/Sinbad.zip","Zip"); Ogre::String sectionName, typeName, dataName; Ogre::ConfigFile cf; cf.load("resources_d.cfg"); Ogre::ConfigFile::SectionIterator sectionIter = cf.getSectionIterator(); while(sectionIter.hasMoreElements()) { sectionName = sectionIter.peekNextKey(); Ogre::ConfigFile::SettingsMultiMap *settings = sectionIter.getNext(); Ogre::ConfigFile::SettingsMultiMap::iterator i; for( i = settings->begin() ; i != settings->end() ; ++i ) { typeName = i->first; dataName = i->second; Ogre::ResourceGroupManager::getSingleton().addResourceLocation(dataName, typeName, sectionName); } } Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); Ogre::Entity* ent = sceneManager->createEntity("Sinbad.mesh"); sceneManager->getRootSceneNode()->attachObject(ent); sceneManager->setAmbientLight(Ogre::ColourValue(.3f,.3f,.3f)); root->startRendering(); return 0; }
Upload your commented source files into Lab1 in MySchool (zip them up if more than one). The lab projects will not be graded, but their completion counts towards your participation grade.
And check out the next Lab :)