Table of contents
Most of this article is deprecated.
It is in fact possible to compile Ogre for Android now as is explained in this topic.
Cmake Quick Start Guide for Android
Overview
Android is a Linux-based OS designed to be used on mobile and small computing devices (netbooks, embedded systems, tablets, etc.). It is present on a growing number of small computing devices and with the release of recent updates it has now given access to low-level OpenGL ES 2 features.
Android and C++
Android officially supports native applications built using C or C++. Unfortunately the C++ for Android is currently too sparse for Ogre to be ported using the official development kit (called the NDK). The most serious feature missing the exception support. Since Ogre makes heavy use of exception, this missing feature would make it very difficult to create a stable port for Android.
Luckily Android is a very open OS. We don't actually need to use the official NDK to develop native applications that work on Android devices. An awesome community member named Crystax has created versions of the NDK matched to official NDK releases which fully support C++. By using this custom build system we can create working native applications for Android without having to modify the underlying Android OS.
Porting Ogre to Android
When porting Ogre to any new OS the most important element is the Render system. This subsystem encapsulates all of the specifics pertaining to the platform (Android) and the 3D API (OpenGL ES 2). Since GLES2 has a strict standard we can borrow liberally from other GLES2 platforms (like the iPhone). In fact we can just compile against much of the existing GLES2 RenderSystem.
There are still parts that are very OS specific. On many platforms these pieces (like the RenderWindow, and the GL context wrappers) have a large amount of functionality in them. The current version of the Android port has very empty implementations of these classes. This is because much of the native OS resources like windows and GL contexts must be managed from within Java. That leaves little for the C++ side to do. By the time the Ogre rendering system is called, these resources have already been created and set up.
Build Systems
Android's build system is based on makefiles and GCC. However, these systems have been customized for the Android OS. The makefiles are slightly different than they would be for other platforms. For that reason no CMake target currently exists for Android. The makefiles must be hand-made and the native libraries should fit into the expected Android project structure. Below are links to the makefile I currently use to build the Ogre sample browser, as well as the misc. other classes and functions which I use to interact with the Java environment and Android's asset system.
- Android.mk
- AndroidLogListener.h
- AndroidLogListener.cpp
- OgreADPArchive.h
- OgreADPArchive.cpp
- ogresamplebrowser.cpp
- ogrewrapper.h
- ogrewrapper.cpp
Alias: OgreAndroid
Contributors to this page: Emerich , spacegaier and jacmoe .
Page last modified on Saturday 09 of March, 2013 10:17:08 UTC by Emerich .