About two weeks ago, shortly after finishing part 3 I got in contact with Cygon from the Mogre forums. As far as I could tell he is the only person who has sucessfully wrapped the Terrain and Paging component into Mogre. With his help, I’ve managed to integrate his changes into the MogreBuilder to finally bring Mogre up to date with the latest stable version of Ogre (v1.7.4). This is great news for the Mogre community who have been longing for Terrain and Paging in the official build for many months.

Terrain and Paging

My first attempt at getting Terrain and Paging into Mogre was to try and figure out how Cygon had done it from the scattered bits of information floating around the forums. This worked up to a point but I ran into a wall when the AutoWrap tool failed to pickup the files. A little more digging around and I got a little closer followed by one failure after another. Cygon kindly offered to give me a copy of his entire codebase from when he manually wrapped Terrain and Paging with Ogre 1.7.3.

I was very excited when the email arrived with a link to download his code. Eager  and try it out I quickly dumped the code into the MogreBuilder and ran it. After a little tweaking it spat out some binaries. I threw together a really quick test using the Mogre Terrain and Paging sample on the wiki combined with the samples code found in the last installer. It worked like a charm and I went to bed with a grin :)

Mogre TerrainAndPaging Sample using binaries built with MogreBuilder

The following weekend I sat down to clean up the code and get it loaded into the bitbucket repository. This turned into a bit of a chore because the code that I had was a few months old and I had to merge the changes with more recent changes in the repository. Added to that was updating the patching tool in MogreBuilder because Cygon’s patch wasn’t compatible with hg. I also added an extra patch to improve the size and the resulting DLL’s and remove some code not used in C#. Thanks again to Cygon for providing these changes.

I’m pleased to say that in the end it all went well and the Terrain and Paging components are now included in the official MogreBuilder. This should make it easier to maintain future builds of Mogre and might lead the way to getting other plugins wrapped.

Automatic version updating

Another small but important change I made during this iteration is automatic versioning of the Mogre DLL. Thanks to Ümit YILDIZ for pointing out that the previous lot of binaries indicated a version of 1.7.1 even though it was built against Ogre 1.7.4. To correct this issue I added a task into the MogreBuilder to automatically detect the version of Ogre and update Mogre’s assembly information to match.

Here’s a snippet from Ogre’s OgrePrerequisites.h

// Define ogre version
#define OGRE_VERSION_NAME "Cthugha"

And the resulting code in Mogre’s AssemblyInfo.cpp


Using this approach we could also add the Ogre version name or add an additional digit into Mogre’s version using the MogreBuilder config. I’ve left this task for another time.

Mogre Samples

I’ve also added a new Terrain and Paging sample to the Mogre samples found in the installer. Unfortunately, there is still nowhere to load my changes on bitbucket so instead you can download them directly including the binaries, source code and media.

Download Mogre Samples including Terrain and Paging

The end result

I really couldn’t have asked for a better couple of weeks on this project. All of the important chips fell into place at the right time and delivered some great improvements for the Mogre community. I’ve learned a lot about the Mogre build process and I feel more confident that I can help maintain it in the future. Thanks to everyone who provided feedback, it makes all the difference.

Download Mogre 1.7.4 binaries with Terrain and Paging

And of course, the source code is available in the bitbucket repositories.

Shortly after posting the first part of this series on improving the MogreBuilder I was contacted by another user (McDonte). He had been working on a GUI frontend for the automated build tool a few months back and I had offered to host the source code and binaries on my web-host. He sent me a copy of the code and I tested it out. I was hoping to make this part of the series about integrating the GUI but unfortunately, there are still few outstanding bugs to sort out. I was a little conflicted about how to proceed with the GUI side of things, so instead I did what I could with the command line version.

McDonte’s GUI

McDonte did an awesome job creating an option rich GUI to cover just about everything you could think of in the build tool. He also added the missing tasks to automatically download the Ogre source code as part of the build process. I was hoping to be able to build Mogre easily with the GUI, but I ran into a number of issues including:

  • The calls to hg had a syntax error because the -u option was missing from the command line.
  • Cmake reported an error but did not provide a reason.
  • I had to set the paths to TortioseHg and Cmake each time I ran the tool.

Once these issues are fixed I’m sure the GUI version of the tool will be released in one form or another.

The bitbucket repositories

A couple of days later I asked Beauty if I could have access to the MogreBuilder and Mogre repositories on bitbucket. This was no trouble and I uploaded the changes I made to the MogreBuilder command line version.

User Tubulii downloaded the binaries that I compiled last week and tested them out with the Mogre samples. He also had to build MOIS for the input system. Ideally, my goal is to make it easy to grab a copy of the repository and build Mogre out of the box with minimal effort. So it stands to reason that MOIS and the samples should also be included in the build process.

The Mogre samples

Surprisingly the source code for the samples is not on the bitbucket repository. For some reason, the only place the source code could be located was the Mogre installer for version 1.7.1. This is not really acceptable, so I plan to upload the sample source code to bitbucket shortly. I only just managed to get them to compile and run on my machine tonight after some messing around with the project settings.

Every time a new version of Mogre is built it is handy to be able to run through the samples as a smoke test to make sure everything went well.


I’m pretty happy with the progress this week, even though there is not a lot to show for it. The feedback has been great so keep it coming :)

This week I have been helping out with an open source project called Mogre. My mission is to continue the work of another user (Amirabiri) on the MogreBuilder project to automate the build process of Mogre. Over the course of the next few weeks I would like to make the build process much easier and add some new features.

What is Mogre?

Mogre is a .NET wrapper around Ogre, the popular open source graphics engine. It has been developed and maintained by many users over the years. Mogre wraps the Ogre code using C++/CLI code that is automatically generated from a combination of tools. Once complete a stable .NET DLL is produced that allows .NET developers to make use of the powerful Ogre rendering engine in games and tools.

What is MogreBuilder?

The steps involved building Mogre manually is pretty involved. The whole process can take a few hours if you have never done it before and if you encounter any errors along the way it can be tough debugging them. To make this process easier a tool has been developed with the intention of automating the entire process. This should make it a lot easier to build new versions of Mogre each time a new version of Ogre is released.

The tool automates many of the steps but still has a lot to be desired. There are still a number of steps involved and the documentation is limited.

Part 1 – Building Mogre using the auto-builder

I had to make a number of changes to the original source code of the MogreBuilder.
I run the MogreBuilder after each of the following steps to find the next error and fix it.

I have Microsoft Visual C# 2010 Express installed.
I’ve also installed TortiseHg at some point in the past

  1. Download and compile MogreBuilder source as a zip file from https://bitbucket.org/mogre/mogrebuilder
  2. Created C:\Mogre and set the command line parameter in project properties
  3. Downloaded Mogre source as a zip file from https://bitbucket.org/mogre/mogre/overview
  4. Extracted the source into C:\Mogre
  5. Downloaded and installed cmake from http://www.cmake.org/cmake/resources/software.html (add to system path)
  6. Get Ogre source using the command line: (run from the C:\Mogre\Main\OgreSrc directory)
    hg clone http://bitbucket.org/sinbad/ogre/ -u v1-7
  7. The patch failed for file OgreCodec.h so I manually patched it using the reject file.

The auto-builder ran successfully.

The end result

For the moment I haven’t loaded the source code into a repository yet (lack of time), but if you want to have a go at repeating the process yourself you can download my changes to the MogreBuilder in a zip file or you can jump right to the end result and download the .NET 4 binaries.

Modified MogreBuilder source
Mogre .NET 4 Binaries

What’s next?

A few steps can be taken to make development easier:

  • Uploading the source code to a repository.
  • Getting feedback on what’s most important
  • Getting help from other developers

There are loads of little improvements that could be made to the MogreBuilder including:

  • Adding a GUI
  • Automating more of the steps
  • Fixing the patching issue
  • Documentation
  • Adding in other components (Terrain and Paging)
  • Allowing the user to choose which steps to execute (skip the compile if you know it’s already complete)

More information

There is a development thread on the Mogre forums.