Ogre3D 1.10 on Android looking good (with tweak)

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 12

Ogre3D 1.10 on Android looking good (with tweak)

Post by mmixLinus »

Hi all,

I had a go at building Ogre 1.10.0unstable (17 October) for Android and it went pretty well I must say. (Minor tweak needed).

My configuration:
  • Windows 7, MSVC9 "2008"
  • Apache Ant 1.9.3
  • ADT Windows x86 20140702
  • Android NDK R10B
  • CMake 2.8.12.1
  • Hardware: Sony Xperia Z2
Generated build files, and built, with

Code: Select all

cmake -G"NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=..\CMake\toolchain\android.toolchain.cmake -DOGRE_DEPENDENCIES_DIR=..\AndroidDependencies  -DANDROID_NATIVE_API_LEVEL=9 ..
nmake
The tweak: Before building with nmake, I had to fix the include paths to OIS & FreeImage as they were incorrect. They were relative though the corresponding lib paths were absolute, and wrong ("../AndroidDependencies/include") so building OgreFreeImageCodec.cpp failed. So I started cmake-gui and set the include paths to absolute (and also set OGRE_BUILD_ANDROID_JNI_SAMPLE = true), then regenerated build files. Q:Did I set something up wrong to get relative paths?

Anyway, SampleBrowser works impressively, though the UI is gawddamn tiny on a Full HD screen :lol:
The JNISample is great in Full HD though :shock:
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 100

Re: Ogre3D 1.10 on Android looking good (with tweak)

Post by Wolfmanfx »

The JNISample is just red :)
Its purpose is to use it as base for your own app.

Regarding the deps I usually place it relative to the build dir and I guess it must be hardcoded somewhere :)
User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 12

Re: Ogre3D 1.10 on Android looking good (with tweak)

Post by mmixLinus »

Wolfmanfx wrote:The JNISample is just red :)
Exactly! :lol:
Anyway, I'm glad it works, and as you say I can use the JNISample as a starting point.

But.. If I alter ogre/OgreMain/src/Android/JNI/OgreActivityJNI.cpp (say, change the colour) and do an "nmake", the build/make system doesn't pick up the change :( Why is that? (The cpp file isn't built)
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 100

Re: Ogre3D 1.10 on Android looking good (with tweak)

Post by Wolfmanfx »

Yeah go into the build dir there is JNISample folder and do a "ant debug install" should be enough
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 139

Re: Ogre3D 1.10 on Android looking good (with tweak)

Post by c6burns »

Run 'ndk-build' (which should work because NDK root should be in your path) from the project folder before 'ant debug install'. Or optionally you can call 'ant debug' and then use adb yourself to install the resulting apk. ndk-build is basically calling make, and accepts cmd line params like make (eg. ndk-build -j4)

Check out: https://developer.android.com/tools/sdk/ndk/index.html
Way down near the bottom under the heading 'Exploring the hello-jni Sample' there is a good primer on building android projects from command line (without eclipse) :)
User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 12

Re: Ogre3D 1.10 on Android looking good (with tweak)

Post by mmixLinus »

Code: Select all

cd SampleJNI
ndk-build
ant debug install        # or ant debug + adb install App.apk
works perfectly.
Thanks!
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook