Notes on compiling Ogre on Android

Minor issues with the Ogre API that can be trivial to fix
nanarth
Gnoblar
Posts: 6
Joined: Wed Feb 27, 2008 2:26 pm
Location: Grenoble, France
x 2

Notes on compiling Ogre on Android

Post by nanarth »

Hi, I just compiled Ogre on the official AndroidNdk and got threw some problems so I would like to share. I used http://ogre3d.org/forums/viewtopic.php? ... 86#p443919 as a base. These are small remarks so I hope it fits well in papercuts :

Wrong Platform Detection

The platform detection did not worked correctly, at least I think it did not. Instead of having OGRE_PLATFORM_ANDROID defined, i had OGRE_PLATFORM_TEGRA2. This is because Tegra detection is done before Android and based on testing linux and arm. Which is the case of my Android compilation. I fixed it, for me, by commenting the Tegra2 detectiong but I really don't know how to fix it properly of Ogre. In fact I wonder if Tegra2 should be considered as a platform like Win / Linux / Android or OIS ?

Offical Ndk Std Lib

There is two stl implementations shipped with the official Android Ndk : gnustl and stlport. The ndk stlport version does not have typeinfo in it, which is mandatory, is'nt it? The gnustl version does not support wstring neither wostream. To make it simple I decided to use the gnustl and put between #ifdef the wstring methods in OgreUTFString.h.

OGRE_NEW_FIX_FOR_WIN32 in OgreGLES2Prerequisites.h

In the render system compilation of GLES2 there is a define named OGRE_NEW_FIX_FOR_WIN32 that was not correctly set for Android. I replaced :

Code: Select all

#elif (OGRE_PLATFORM == OGRE_PLATFORM_TEGRA2) || (OGRE_PLATFORM == OGRE_PLATFORM_LINUX) || (OGRE_PLATFORM == OGRE_PLATFORM_NACL)
#	define OGRE_NEW_FIX_FOR_WIN32 new
by

Code: Select all

#elif (OGRE_PLATFORM == OGRE_PLATFORM_ANDROID) || (OGRE_PLATFORM == OGRE_PLATFORM_TEGRA2) || (OGRE_PLATFORM == OGRE_PLATFORM_LINUX) || (OGRE_PLATFORM == OGRE_PLATFORM_NACL)
#	define OGRE_NEW_FIX_FOR_WIN32 new
In the same way I had troubles with OGRE_NEW in OgreGLSLESProgramFactory.cpp. So I replaced by the OGRE_NEW_FIX_FOR_WIN32 even if it seems strange to me.

Components/RTShaderSystem/src/OgreRTShaderSystem.cpp

The file above still exists in the main branch while the class RTShaderSystem seems to be removed from the project.

I hope it can help to fix some stuff. If i can do anything to help, let me know.