Thursday 19 May 2011

Install Ogre on ubuntu

DO NOT EXECUTE THE APT-INSTALLATION: 
$ sudo apt-get install libogre-dev ogre-doc


Ubuntu 11.04, Ogre 1.7.3


Install requirements

Install building tools (make, cmake (needed by latest Ogre), gcc, g++)
$ sudo apt-get install build-essential automake libtool cmake-gui libpoco-dev doxygen libfreetype6-dev libxaw7-dev

Install OpenGL implementation:
$ sudo apt-get install libgl1-mesa-dev

Install SDL:
$ sudo apt-get install libsdl1.2-dev

Install Ogre
download ogre_src_v1-7-3.tar.bz2 from http://www.ogre3d.org/download/source
$ unzip it in ~/work/ogre
$ mkdir ~/work/ogre_build
$ cd ~/work
$ cmake-gui
Where is the source code: ~/work/ogre
Where to build the binaries: ~/work/ogre_build
Configure
Choose unix makefiles/use default native compilers
Check all lines, except ogre_static.
Configure
Generate
$ cd ~/work/ogre_build
$ make
$ sudo make install
$ sudo ldconfig

Install Code::Blocks
$ sudo apt-get install codeblocks


Create a game
$ codeblocks
File/New/Project.../Ogre project

create files plugins.cfg and resources.cfg :
a) project_path/plugins.cfg
 # Defines plugins to load

# Define plugin folder
PluginFolder=/usr/local/lib/OGRE/

# Define D3D rendering implementation plugin
Plugin=RenderSystem_GL.so
Plugin=Plugin_ParticleFX.so
Plugin=Plugin_BSPSceneManager.so
Plugin=Plugin_OctreeSceneManager.so
Plugin=Plugin_CgProgramManager.so


b) project_path/resources.cfg
# Resources required by the sample browser and most samples.
[Essential]
Zip=/usr/local/share/OGRE/media/packs/SdkTrays.zip
FileSystem=/usr/local/share/OGRE/media/thumbnails

# Common sample resources needed by many of the samples.
# Rarely used resources should be separately loaded by the
# samples which require them.
[Popular]
FileSystem=/usr/local/share/OGRE/media/fonts
FileSystem=/usr/local/share/OGRE/media/materials/programs
FileSystem=/usr/local/share/OGRE/media/materials/scripts
FileSystem=/usr/local/share/OGRE/media/materials/textures
FileSystem=/usr/local/share/OGRE/media/materials/textures/nvidia
FileSystem=/usr/local/share/OGRE/media/models
FileSystem=/usr/local/share/OGRE/media/particle
FileSystem=/usr/local/share/OGRE/media/DeferredShadingMedia
FileSystem=/usr/local/share/OGRE/media/PCZAppMedia
FileSystem=/usr/local/share/OGRE/media/RTShaderLib
Zip=/usr/local/share/OGRE/media/packs/cubemap.zip
Zip=/usr/local/share/OGRE/media/packs/cubemapsJS.zip
Zip=/usr/local/share/OGRE/media/packs/dragon.zip
Zip=/usr/local/share/OGRE/media/packs/fresneldemo.zip
Zip=/usr/local/share/OGRE/media/packs/ogretestmap.zip
Zip=/usr/local/share/OGRE/media/packs/ogredance.zip
Zip=/usr/local/share/OGRE/media/packs/Sinbad.zip
Zip=/usr/local/share/OGRE/media/packs/skybox.zip

[General]
FileSystem=/usr/local/share/OGRE/media

edit main.cpp:
#include "ExampleApplication.h"

class Example : public ExampleApplication
{
public:

    void createScene()
    {
        Ogre::Entity* ent = mSceneMgr->createEntity("MyEntity","Sinbad.mesh");
        Ogre::SceneNode* node = mSceneMgr->createSceneNode("Node1");
        mSceneMgr->getRootSceneNode()->addChild(node);
        node->attachObject(ent);

       
    }
};

int main (void)
{
    Example app;
    app.go();
    return 0;
}

download Sinbad.mesh in project_path (from http://opengameart.org/content/sinbad-the-ogre download sinbad_maya.zip and extract Sinbad.mesh from it)


Build game
Build/Select target/Release
run output executable from console (Build/Run freezes the display:( )

References
http://www.ogre3d.org/forums/viewtopic.php?f=1&t=56799G

No comments:

Post a Comment