Android manipulation of ogre

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
josemi
Gnoblar
Posts: 20
Joined: Tue Jun 25, 2013 8:54 am
Location: Spain

Android manipulation of ogre

Post by josemi » Wed Jun 26, 2013 9:00 am

Hello, I'm trying to develop an Android app that using OpenCV detects an Augmented Reality marker and using Ogre3D draws a model on it. I have been looking for 2 weeks and found that openCV implementation with Android is very good, but Ogre only works in almost full native builds and I have no idea of how to integrate it.

There are any examples or tutorials for what I'm trying?
Can any of you suggest a way to follow?

Thanks in advance!!
0 x

robert82h
Gnoblar
Posts: 23
Joined: Thu Jun 13, 2013 5:41 pm

Re: Android manipulation of ogre

Post by robert82h » Wed Jun 26, 2013 11:48 am

Hi Josemi,

as far as I know there's only the SampleBrowser and OgreJNI. Sample browser uses a native activity, i.e., everything is done in C++ and (almost) no Java code is involved. Then on the other hand there's the OgreJNI example which uses a regular Android activity created in Java land. I went with the latter approach, works fine so far.

I guess the choice depends a bit on whether you want to extend your application's activity with other Android controls. This is probably easier to do with the OgreJNI approach. Or if you want to wrap an Ogre view in a fragment that can be positioned anywhere inside an activity. On the other hand, if you just want to write a full-screen game-like application with little or no Android specific parts, the native activity approach is the easier.

What do you mean by "almost full native builds"?
0 x

josemi
Gnoblar
Posts: 20
Joined: Tue Jun 25, 2013 8:54 am
Location: Spain

Re: Android manipulation of ogre

Post by josemi » Wed Jun 26, 2013 12:14 pm

Thanks for your answer, I'm not making a game, I only want to show a model in a Marker detected by openCV so I think that the second Option(ogre jni) is better. Where can I find the example? I googled it but I didn't found it.

PD: About the "almost full native builds" I was talking about the first option (samplebrowser), so it doesn't matter now :P

Thanks!!
0 x

robert82h
Gnoblar
Posts: 23
Joined: Thu Jun 13, 2013 5:41 pm

Re: Android manipulation of ogre

Post by robert82h » Wed Jun 26, 2013 12:26 pm

It's in ./build/OgreJNI after you've built Ogre for Android. Just grab the whole directory, copy the file OgreActivityJNI.cpp from ogre/OgreMain/src/Android/JNI into jni/ and remove the LOCAL_PATH line from jni/Android.mk
0 x

josemi
Gnoblar
Posts: 20
Joined: Tue Jun 25, 2013 8:54 am
Location: Spain

Re: Android manipulation of ogre

Post by josemi » Wed Jun 26, 2013 1:07 pm

oh, that's a problem, I found error while trying to build ogre for android (using windows 7 64b). Now it is telling me that "NMake must run from a shell that can use the compiler CL" and doesn't compile. Can anyone upload de OGREJNI folder to look at it? or even better tell me why I can't build Ogre
0 x

robert82h
Gnoblar
Posts: 23
Joined: Thu Jun 13, 2013 5:41 pm

Re: Android manipulation of ogre

Post by robert82h » Wed Jun 26, 2013 2:08 pm

I built on Ubuntu so I can't help you with that. Did you follow the steps at http://www.ogre3d.org/tikiwiki/tiki-ind ... on=Android?
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Android manipulation of ogre

Post by c6burns » Thu Jun 27, 2013 4:57 am

Use the visual studio command prompt to run cmake and nmake :)
0 x

josemi
Gnoblar
Posts: 20
Joined: Tue Jun 25, 2013 8:54 am
Location: Spain

Re: Android manipulation of ogre

Post by josemi » Thu Jun 27, 2013 8:57 am

Yes, I followed that steps, now I have other error, I go inside the "Build" folder and execute "cmake -G"NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=..\cmake\toolchain\android.toolchain.cmake -DOGRE_DEPENDENCIES_DIR=..\AndroidDependencies -DANDROID_ABI=armeabi -DANDROID_NATIVE_API_LEVEL=9 .." but now it is failing again and telling: "could not find toolchain file"

PD: which is the directory to execute the previous step? "cmake -G"NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=..\cmake\android.toolchain.cmake -DANDROID_ABI=armeabi .."

PD2: Using visual studio cmd fix CL error :) thx
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Android manipulation of ogre

Post by c6burns » Thu Jun 27, 2013 11:24 pm

Your ogre source should be from the 1.9 branch, and in the directory should look like something like this:
<ogresrc>/AndroidDependencies <-- contents of zip
<ogresrc>/build <-- empty directory you make yourself

Skip step 6 on the wiki if you are just unzipping the dependencies, which I recommend. You execute the cmake command from inside your empty build directory, and it will find the toolchain in the <ogresrc>/CMake directory one level up.
0 x

Post Reply