Logo of the Ogre 3D Engine

Mogre 1.7.3

Ogre 3D Logo

My last contact with Ogre 3D had been in 2008, when I had created an experimental x64 build (back then, OpenJPEG, FreeImage and some other dependencies didn’t yet build in x64 by default).

This worked out fine, but I didn’t find the time to actually do anything with Ogre. Finally, during the past weekend, I took a closer look at Mogre, a C++/CLI-based wrapper that enables you to use Ogre in .NET languages.

Dependencies, Dependencies

I’m always a bit saddened if I see AAA games installing 3 different versions of the Visual C++ runtime and requiring 4 versions of the D3DX libraries at once. That means the developers simply used what binaries they could find, without investing a little bit of time to do a consistent build.

So I decided to do better and get me some good builds of all of Mogre’s dependencies. I decided to use the Visual C++ Multithreaded DLL runtime, which means all C/C++ library code is loaded from msvcr100.dll (C) and msvcp100.dll (C++) only once and all libraries share a single heap. That sounds better to me than having half a dozen different runtimes in memory, some compiled into their DLLs statically, others loaded from various msvc*.dlls :)

The most difficult part was FreeImage due to its tons of image loading libraries it contains: ilmbase, openexr, libjpeg, zlib (for libpng), libpng, libmng, libtiff, libraw and libungif. After some effort, I ended up with this nice set of binaries: FreeImage 3.15.1 binaries.

Next was Boost. Not too difficult to compile, but one gigantic collection of C++ headers that takes minutes to download from a Subversion repository. Luckily, Boost consist of individual libraries, so I checked which libraries I really wanted (regex, datetime and math) and only included the minimal amount of headers needed for those libraries. Instead of 8597 headers, I ended up with 902.

After some other minor efforts (FreeType almost compiles itself) it finally was Ogre’s turn!

Ogre and Mogre

This proved a bit more difficult again because Ogre seemed to have abandoned its Visual Studio solutions and went with CMake. Not wanting to settle for that, I recreated all of the solutions in Visual Studio 2010 (the advantage is that in the end I can add the Ogre projects to my game, edit Ogre’s sources and press F5 without having to worry about building Ogre all over again, copying DLLs around and stuff).

The problem with Mogre was that it has a rather complex set of build steps and upon searching the forums, there were various sets of patches and modified sources in several repositories. I wasn’t sure whether I should start with the official sources or pick one of the personal forks, so I just chose whatever promised me to work against the most up-to-date version I could find while also supporting Ogre’s terrain plugins.

To make it short, it took a lot of fiddling and analyzing what Mogre’s "AutoWrap" does to eventually end up with a clean build. It was really exciting seeing Mogre running in a 64-bit .NET 4.0 executable, rendering the example scene to the screen for the first time :D

Screenshot of the Mogre example application rendering a big Ogre head

I then spent some time building some other libraries I thought I could use, like OIS/MOIS (Ogre’s input device manager), Newton/MogreNewt (Newton physics integration – that developer has seriously messed up his build configurations) and Bullet/BulletSharp (Bullet physics integration). It took some more time to track down a crash issue I had when shutting down Mogre, but it all worked out in the end!

I think this is a good place to say thanks to the Mogre community as well who were nothing but helpful in my endeavor :)

Binaries

After all was said and done, I wrote down detailed instructions on what I’ve done to build each project involved and packaged the final binaries into my own little SDK which enables anyone to download a single .zip archive, open the contained solution in Visual Studio and press F5 to get a working Mogre application running on his screen.

All binaries (including all their dependencies down to the smallest library) have been compiled with Visual C++ 2010 SP1 targeting the multi-threaded DLL runtime, so this is a completely homogeneous build that only requires the Visual C++ 2010 SP1 redistributable (download in 32 bit or 64 bit) and nothing else. I took the liberty of enabling SSE2 optimizations everywhere because I can’t think of any system you’d want to run Ogre on that doesn’t have an SSE2-capable CPU.

The Ogre and Mogre binaries for use in your own projects can be found in the Directory Icon References directory. I included all Ogre and Mogre headers, so you can also use this package as an SDK to compile other Mogre extensions or even as a plain Ogre SDK if the homogeneous build or SSE2 goodness piqued your interest!

Download

Download

MogrePatchesAndSolutions-1.7.3.7z (140 KiB)
MogreTutorial-1.7.3-VC2010-x86-x64.7z (53.7 MiB)

Ogre/Mogre binaries can be found here:

  • Directory Icon References
    • Directory Icon Ogre (1.7.3)
      • Directory Icon include (Mogre-adjusted headers)
      • Directory Icon msvc-10.0-x86 (32 bit DLL and import library)
      • Directory Icon msvc-10.0-x64 (64 bit DLL and import library)
    • Directory Icon Mogre (1.7.3)
      • Directory Icon include (Headers)
      • Directory Icon net-4.0-x86 (32 bit assembly for .NET 4.0)
      • Directory Icon net-4.0-x64 (64 bit assembly for .NET 4.0)

7 thoughts to “Mogre 1.7.3”

  1. I’m currently using Ogre directly (without any .NET) because I want to try and build one of the first 3D Metro games in the App Store (Ca-Ching $.$)

    It seems with Zarfius’ updates to MogreBuilder, Mogre is in good health. Ogre 1.8.0 may require some updated patches — when Ogre 1.8.0 is released and nobody jumped in until then, I’ll see if I can take care of that. No promises, though :)

  2. Thanks a lot for the complete builds!! You saved many people (noobs) lots of headaches.

  3. Hi,
    I tried to compile Mogre 1.7.4 x64 with mogrebuilder. All compiled fine, but i’ve an error when i call ResourceGroupManager.Singleton.AddResourceLocation function. I saw that you did the same job with mogre 1.7.3. I took your tutorial, and i had the same error :
    L'exception System.AccessViolationException n'a pas été gérée
    HResult=-2147467261
    Message=Tentative de lecture ou d'écriture de mémoire protégée. Cela indique souvent qu'une autre mémoire est endommagée.
    Source=Mogre
    StackTrace:
    à Ogre.ResourceGroupManager.addResourceLocation(ResourceGroupManager* , basic_string<char\,std::char_traits\,std::allocator >* , basic_string<char\,std::char_traits\,std::allocator >* , basic_string<char\,std::char_traits\,std::allocator >* , Boolean )
    à Mogre.ResourceGroupManager.AddResourceLocation(String name, String locType, String resGroup) dans e:\net-4.0\mogre-1.7.3\main\src\auto\mogreresourcegroupmanager.cpp:ligne 501
    à Mogre.TutorialFramework.BaseApplication.LoadResources() dans c:\VS\Test projects\MogreTutorial-1.7.3-VC2010-x86-x64\MogreTutorial\Source\BaseApplication.cs:ligne 118

    I don’t have this error if i add /*.* in the ressources.cfg line, but after the ressources are not founded.

    Can you help me please, i’ve no choice, i’ve to work under windows 8 x64.

    Thanks

  4. I tried again on a windows 7 machine, there is not error on loading ressources, but there is an error when i call mWindow.GetCustomAttribute(“Window”,Out windowed) :System.StackOverflowException. If i don’t use MOIS initialisation, i’ve another one when i call mRoot.Startrendering System.NullReferenceException.

    Please help me.

  5. RMI, I had the same problem.

    I resolve passing the full path:

    FileSystem=C:\\………\\Media

    If anyone have the same problem, this is a way to fixed

Leave a Reply

Your email address will not be published. Required fields are marked *

Please copy the string 3cAopQ to the field below:

This site uses Akismet to reduce spam. Learn how your comment data is processed.