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!!
Android manipulation of ogre
-
- Gnoblar
- Posts: 20
- Joined: Tue Jun 25, 2013 8:54 am
- Location: Spain
-
- Gnoblar
- Posts: 23
- Joined: Thu Jun 13, 2013 5:41 pm
- x 7
Re: Android manipulation of ogre
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"?
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"?
-
- Gnoblar
- Posts: 20
- Joined: Tue Jun 25, 2013 8:54 am
- Location: Spain
Re: Android manipulation of ogre
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
Thanks!!
PD: About the "almost full native builds" I was talking about the first option (samplebrowser), so it doesn't matter now
Thanks!!
-
- Gnoblar
- Posts: 23
- Joined: Thu Jun 13, 2013 5:41 pm
- x 7
Re: Android manipulation of ogre
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
-
- Gnoblar
- Posts: 20
- Joined: Tue Jun 25, 2013 8:54 am
- Location: Spain
Re: Android manipulation of ogre
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
-
- Gnoblar
- Posts: 23
- Joined: Thu Jun 13, 2013 5:41 pm
- x 7
Re: Android manipulation of ogre
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?
- c6burns
- Beholder
- Posts: 1512
- Joined: Fri Feb 22, 2013 4:44 am
- Location: Deep behind enemy lines
- x 138
Re: Android manipulation of ogre
Use the visual studio command prompt to run cmake and nmake
-
- Gnoblar
- Posts: 20
- Joined: Tue Jun 25, 2013 8:54 am
- Location: Spain
Re: Android manipulation of ogre
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
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
- c6burns
- Beholder
- Posts: 1512
- Joined: Fri Feb 22, 2013 4:44 am
- Location: Deep behind enemy lines
- x 138
Re: Android manipulation of ogre
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.
<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.