| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| public:t-gede-15-1:lab1 [2015/01/10 11:52] – [Lab Project] marino | public:t-gede-15-1:lab1 [2024/04/29 13:33] (current) – external edit 127.0.0.1 |
|---|
| </box> | </box> |
| - **Change your build output directory:** Configuration Properties->General->Output Directory\\ Add ''$(ProjectName)\'' at the end of the output directory so it will look like:''$(SolutionDir)$(Configuration)\$(ProjectName)\''\\ This will help with organizing the builds for each lab project.{{ :public:t-gede-14-1:gede_lab1_outputdir.png?nolink |}} | - **Change your build output directory:** Configuration Properties->General->Output Directory\\ Add ''$(ProjectName)\'' at the end of the output directory so it will look like:''$(SolutionDir)$(Configuration)\$(ProjectName)\''\\ This will help with organizing the builds for each lab project.{{ :public:t-gede-14-1:gede_lab1_outputdir.png?nolink |}} |
| - **Add additional include libraries:** C/C++->General->Additional Include Directories =<code>$(OGRE_HOME)\include\OIS;$(OGRE_HOME)\include\OGRE;$(OGRE_HOME)\include;$(OGRE_HOME)\boost;%(AdditionalIncludeDirectories)</code> <box red 100% | Note: >If the C/C++ tab is missing. For some reason, with some versions of Visual Studio you will need to have created a cpp file in order to get the C/C++ tab in the configuration properties, so adding a main.cpp file with a basic "hello world" to the project and building it will suffice. ) | - **Add additional include libraries:** C/C++->General->Additional Include Directories = **Notice, for all configurations!**<code>$(OGRE_HOME)\include\OIS;$(OGRE_HOME)\include\OGRE;$(OGRE_HOME)\include;$(OGRE_HOME)\boost;%(AdditionalIncludeDirectories)</code> <box red 100% | Note: >If the C/C++ tab is missing. For some reason, with some versions of Visual Studio you will need to have created a cpp file in order to get the C/C++ tab in the configuration properties, so adding a main.cpp file with a basic "hello world" to the project and building it will suffice. ) |
| </box>{{ :public:t-gede-14-1:gede_lab1_additional_include_directories.png?nolink |}} | </box>{{ :public:t-gede-14-1:gede_lab1_additional_include_directories.png?nolink |}} |
| - **Add connections to additional Ogre and input libraries:** Linker->Input->Additional Dependencies <code>Debug: OgreMain_d.lib;OIS_d.lib;%(AdditionalDependencies) | - **Add connections to additional Ogre and input libraries:** Linker->Input->Additional Dependencies <code>Debug: OgreMain_d.lib;OIS_d.lib;%(AdditionalDependencies) |
| Ogre::Root* root = new Ogre::Root("../LabFiles/OgreConfig/plugins_d.cfg","../LabFiles/OgreConfig/ogre.cfg"); | Ogre::Root* root = new Ogre::Root("../LabFiles/OgreConfig/plugins_d.cfg","../LabFiles/OgreConfig/ogre.cfg"); |
| </code> | </code> |
| - This will guarantee that you will always be using the same configuration for all runs. | - This will guarantee that you will always be using the same configuration for all runs independent of the project you are working on. |
| </box> | </box> |
| |
| |
| <code cpp> | <code cpp> |
| #include "OGRE/Ogre.h" | #include "OGRE/OgreRoot.h" |
| | #include "OGRE/OgreSceneManager.h" |
| int main() | #include "OGRE/OgreSceneNode.h" |
| | #include "OGRE/OgreRenderWindow.h" |
| | #include "OGRE/OgreConfigFile.h" |
| | #include "OGRE/OgreEntity.h" |
| | |
| | int main() |
| { | { |
| Ogre::Root* root = new Ogre::Root("plugins_d.cfg"); | Ogre::Root* root = new Ogre::Root("../LabFiles/OgreConfig/plugins_d.cfg","../LabFiles/OgreConfig/ogre.cfg"); |
| |
| if(!root->showConfigDialog()) { | if(!root->showConfigDialog()) { |
| return -1; | return -1; |
| } | } |
| | |
| Ogre::RenderWindow* window = root->initialise(true, "Ogre3D Beginners Guide"); | Ogre::RenderWindow* window = root->initialise(true, "Ogre3D Beginners Guide"); |
| | |
| Ogre::SceneManager* sceneManager = root->createSceneManager(Ogre::ST_GENERIC); | Ogre::SceneManager* sceneManager = root->createSceneManager(Ogre::ST_GENERIC); |
| | |
| Ogre::Camera* camera = sceneManager->createCamera("Camera"); | Ogre::Camera* camera = sceneManager->createCamera("Camera"); |
| camera->setPosition(Ogre::Vector3(0,0,30)); | camera->setPosition(Ogre::Vector3(0,0,30)); |
| camera->lookAt(Ogre::Vector3(0,0,0)); | camera->lookAt(Ogre::Vector3(0,0,0)); |
| camera->setNearClipDistance(5); | camera->setNearClipDistance(5); |
| | |
| Ogre::Viewport* viewport = window->addViewport(camera); | Ogre::Viewport* viewport = window->addViewport(camera); |
| viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0)); | viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0)); |
| | |
| camera->setAspectRatio(Ogre::Real(viewport->getActualWidth())/Ogre::Real(viewport->getActualHeight())); | 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::String sectionName, typeName, dataName; |
| Ogre::ConfigFile cf; | Ogre::ConfigFile cf; |
| cf.load("resources_d.cfg"); | cf.load("../LabFiles/OgreConfig/resources_d.cfg"); |
| Ogre::ConfigFile::SectionIterator sectionIter = cf.getSectionIterator(); | Ogre::ConfigFile::SectionIterator sectionIter = cf.getSectionIterator(); |
| | |
| while(sectionIter.hasMoreElements()) { | while(sectionIter.hasMoreElements()) { |
| sectionName = sectionIter.peekNextKey(); | sectionName = sectionIter.peekNextKey(); |
| } | } |
| } | } |
| | |
| Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); | Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); |
| | |
| Ogre::Entity* ent = sceneManager->createEntity("Sinbad.mesh"); | Ogre::Entity* ent = sceneManager->createEntity("Sinbad.mesh"); |
| sceneManager->getRootSceneNode()->attachObject(ent); | sceneManager->getRootSceneNode()->attachObject(ent); |
| | |
| sceneManager->setAmbientLight(Ogre::ColourValue(.3f,.3f,.3f)); | sceneManager->setAmbientLight(Ogre::ColourValue(.3f,.3f,.3f)); |
| | |
| root->startRendering(); | root->startRendering(); |
| | |
| return 0; | return 0; |
| } | } |
| </code> | </code> |
| ===== When You Are Finished ===== | ===== When You Are Finished ===== |
| |
| Upload your 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 labs grade. | This lab projects will not be graded, but their completion counts towards your labs grade. |
| | |
| And check out the next [[public:t-gede-15-1:lab2|Lab]] :) | |