Setting up a basic OGRE 2.1 Project

Problems building or running the engine, queries about how to use features etc.
Post Reply
Posts: 8
Joined: Wed Jan 24, 2018 3:15 am

Setting up a basic OGRE 2.1 Project

Post by jay81 » Wed Jan 24, 2018 3:28 am

Hello Ogre Community,

This is my second attempt at learning Ogre. I am optimistic, but I shamefully need extra assistance getting going. I am swallowing my pride and asking for help getting to a really basic starting point. I’ve read the CMakeLists, tutorial .cpp files, the Dergo example, and everything else I can get my hands on. Alas, none of it was able to explain me how to start a basic Ogre Project and most assume that I’m using this IDE or that IDE ( I’m running on Linux (Fedora) and it is my preference to not use an IDE ).

I understand that the term “basic Ogre Project” is nebulous. To me, a “basic Ogre Project” only includes the bare essentials required to compile and run the tutorials ( I’ll even just take Tutorial01_Initialization ).
A typical Ogre project structure.

Code: Select all

+---Project Root Directory
|   |   
|   +--- Sources
|   |       main.cpp
|   |       file_1.cpp
|   |       file_2.cpp    
|   +--- Headers
|   |       main.h
|   |       file_1.h
|   |       file_2.h
|   +--- Others?
A CMakeLists.txt file with nothing more than the extreme basics ( No nesting CMakeLists files, please. This is also for my education thus I would like to see it all in one place so that I can understand how the project is assembled ):
  • cmake_minimum_required( VERSION X.X )
  • project( MyProject )
  • set (CMAKE_CXX_STANDARD 11) # If it is needed/wanted
  • find_package( The packages that we need to find )
  • include_directories( The directories that we need to include )
  • link_directories( The directories with files to be linked to )
  • add_library( MyProjectLibs The sources )
  • add_executable( MyProject main.cpp the sources then the headers )
  • target_link_libraries( MyProject MyProjectLibs )
  • config_project( MyProject “This stuff” )
I built Ogre 2.1 with the following commands

Code: Select all

$ make
# make install
Please assume that everything was installed to the default locations. Also, assume that I know next to nothing.
0 x

User avatar
Posts: 409
Joined: Thu Jun 04, 2009 3:21 am
Location: Kalamazoo,MI

Re: Setting up a basic OGRE 2.1 Project

Post by Herb » Fri Jan 26, 2018 2:21 pm

For just code, it doesn't get much simpler for 2.1 to look at "EmptyProject" under Samples/2.0/Tutorials. It'll pull some common code from Samples/2.0/Common as well.

For the CMake side, I guess it depends on how comfortable you are with cmake... If you look under your root Ogre directory CMake/Packages, you'll find useful find scripts. One of them is actually FindOGRE.cmake. Use this for your basic project. I use OIS, so I grab FindOIS.cmake. If you're using SDL2 for input, grab FindSDL2.cmake.

Should be basic cmake to find depencidies (find scripts above), and then snag the EmptyProject code to start. You'll also want to copy over the necessary media files (models / etc) and the Hlms directory.

I found the Sample "V2Mesh" to be a good one to look at if you're new (Samples/2.0/ApiUsage/V2Mesh). It's converting and showing a mesh. So, you have a basic app that shows a model and uses a camera system. That can be a good spot to learn and have a basic app starting point.
0 x

Posts: 8
Joined: Wed Jan 24, 2018 3:15 am

Re: Setting up a basic OGRE 2.1 Project

Post by jay81 » Sat Jan 27, 2018 6:19 am

Thank you Herb,

I am following your advice. I'm hitting snags, but I am overcoming them. I'll post again if I get blocked.

Thank you,
0 x

Post Reply