User Tools

Site Tools


public:t-gede-12-1:buildingogrefromscratch

Steps for Building a New Ogre App Totally from Scratch

This is a condensed, corrected and Windows only version of the information provided on the Building Ogre and Setting Up An Application wiki pages on the Ogre Wiki. Go there directly for more information and for setting this up on other platforms.

General Preparation

  1. Download and install Microsoft Visual C++ Express 2010 (if you don't have it)

Building Ogre from Source Files

  1. Download and decompress the OGRE 1.7.3 Source For Windows (this should create the folder “ogre_src_v1-7-3”)
  2. Download Microsoft Visual C++ Dependencies Package, unzip it, and place the folder Dependencies inside ogre_src_v1-7-3
  3. Build the ogre_src_v1-7-3\Dependencies\src\OgreDependencies.VS2010.sln solution
  4. Download and install CMake (Recommend “Add CMake to the system PATH” option)
  5. Run “CMake (cmake-gui)”
    1. Browse to ogre_src_v1-7-3 to enter location of source code
    2. Create and browse to a separate directory for the built binaries, e.g. ogre_built
    3. Press “Configure” and pick your target compiler (i.e. Visual C++ Express 2010) (when done, you see new configuration variables in red)
    4. Press “Configure” again (configuration variables turn gray)
    5. Press “Generate”
  6. Go to your ogre_built directory and build the OGRE.sln solution
    1. If this build goes well, you can test the Ogre examples by running SampleBrowser_d.exe under ogre_built\bin\debug (if built with the debug configuration)

Creating Your Ogre Application

  1. Create a new Win32 project (Windows Application, Empty Project)
  2. Download and add the Ogre Tutorial Framework Files to your project
  3. Configure your project properties (Debug Configuration) (Replace “C:\Development” with your own development directory):
    1. General → Character Set → Use Multi-Byte Character Set
    2. Debugging → Command → .\Debug\$(ProjectName).exe
    3. Debugging → Working Directory → .\Debug
    4. C/C++ → General → Additional Include Directories → C:\Development\ogre_src_v1-7-3\OgreMain\include;C:\Development\ogre_src_v1-7-3\Dependencies\include;C:\Development\ogre_src_v1-7-3\Dependencies\include\OIS;C:\Development\ogre_src_v1-7-3\Samples\Common\include;C:\Development\ogre_built\include
    5. Linker → General → Additional Library Directories → C:\Development\ogre_built\lib\Debug; C:\Development\ogre_src_v1-7-3\Dependencies\lib\Debug
    6. Linker → Input → Additional Dependencies → OgreMain_d.lib;OIS_d.lib;%(AdditionalDependencies)
  4. Build your project (Debug Configuration)
  5. Add C:\Development\ogre_built\bin\debug to your windows system PATH environment variable (so the Ogre DLLs can be found)
  6. Copy resources_d.cfg and plugins_d.cfg into the folder with your new Ogre application (local Ogre configuration)
  7. Run your application
    1. After going through a configuration screen you should see a black render window
  8. Add the following code to your TutorialApplication.ccp inside the TutorialApplication::createScene(void) function, build and run.
    Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh");
     
        Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
        headNode->attachObject(ogreHead);
     
        // Set ambient light
        mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
     
        // Create a light
        Ogre::Light* l = mSceneMgr->createLight("MainLight");
        l->setPosition(20,80,50);

    - You should now see a green Ogre head!

/var/www/cadia.ru.is/wiki/data/pages/public/t-gede-12-1/buildingogrefromscratch.txt · Last modified: 2024/04/29 13:33 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki