[Android] OgreSamples for Android released

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
Hotshot5000
OGRE Contributor
OGRE Contributor
Posts: 226
Joined: Thu Oct 14, 2010 12:30 pm
x 56

[Android] OgreSamples for Android released

Post by Hotshot5000 »

You can get it at: https://bitbucket.org/Sebastian_Bugiu/o ... ablesample

A little explanation on how to build for Android:

0. Clone https://bitbucket.org/Sebastian_Bugiu/ogre and switch to gles3-android branch. Get the Android SDK and NDK in working order, set the paths etc.
1. Build ogredeps for android using the Unix makefiles settings and the android toolchain file in ogredeps/cmake. Both ogre and ogredeps and the project that you're building have to be build with the same ANDROID_NATIVE_API_LEVEL. I recommend version 19 since the newer versions have problems with the FreeImage library in ogredeps (you could try building a newer version of FreeImage but I haven't tried). The ANDROID_ABI should be armeabi-v7a with NEON.
2. Build ogre with android toolchain in cmake folder. Again, use the same settings for building as with ogredeps. Make sure that BUILD_RENDERSYSTEM_GLES is disabled, but enable GLES3 and CONFIG_ENABLE_GLES3_SUPPORT. You should add the freetype, freeimage, zlib and zziplib libraries because they are needed for samples.
3. If you are too lazy to do all the above you can download the compiled libs for both ogredeps and ogre (they are built with android-19) from here: http://headwayentertainment.net/ogre_libs.zip
4. Now clone https://bitbucket.org/Sebastian_Bugiu/o ... ablesample, open the project in Android Studio and change the paths in CMakeLists.txt to where is your ogre path, where is the build path, where is ogredeps build path etc. like here:

Code: Select all

SET(OGRE_ANDROID_BUILD_INCLUDE_PATH d:/Sebi/projects/ogre_build_android2)
SET(OGRE_ZZIPLIB_PATH D:/Sebi/projects/ogredeps/src)
SET(OGRE_INCLUDE_PATH c:/Sebi/projects/ogre)
SET(OGREDEPS_BUILD_INCLUDE_PATH d:/Sebi/projects/ogre/Dependencies_android)
SET(OGRE_LIB_PATH d:/Sebi/projects/ogre_build_android2/lib)
SET(OGRE_DEPS_LIB_PATH d:/Sebi/projects/ogre/Dependencies_android/lib)
Right now there are 2 samples: CustomRenderable and PbsMaterials. In main.cpp you can configure which one to build at the top of the file:

Code: Select all

#define CUSTOM_RENDERABLE 1
#define PBS_MATERIALS 2
#define SAMPLE PBS_MATERIALS
The code is kind of a mess and the configuration can be simplified but right now it should give you a start on how to use Ogre on Android in your project.

Of course, pull requests, bug reports etc. are welcome. I will maintain this fork in the future and if there is any wish to merge it with the main ogre repository it can be done since I will keep it up to date with the main line. But first I think it should be better tested by as many individuals as possible, iron out the problems and after it's stable, we can merge it.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [Android] OgreSamples for Android released

Post by dark_sylinc »

That is awesome!

I should clone your fork... and try it myself! (I'm so busy right now!! :cry: )
Seranth
Gnoblar
Posts: 15
Joined: Mon Jul 11, 2016 1:50 am
x 1

Re: [Android] OgreSamples for Android released

Post by Seranth »

Roughly how far would you say you've gotten on GLES3? Will I be able to use Ogre3D 2.1 for Android any time soon? What rough percentage would you say you're at, 25%? 50%? 75%? 97.3%?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [Android] OgreSamples for Android released

Post by dark_sylinc »

@Hotshot5000 I'm trying to compile your Ogre repo for Android, but I'm getting some trivial compiler errors. What NDK version did you use?
Hotshot5000
OGRE Contributor
OGRE Contributor
Posts: 226
Joined: Thu Oct 14, 2010 12:30 pm
x 56

Re: [Android] OgreSamples for Android released

Post by Hotshot5000 »

Sorry for the late reply. 13b it was. If needed post your error here and I'll try to help as best as I can. I recommend starting with https://bitbucket.org/Sebastian_Bugiu/o ... ablesample. In androidJNI there are a few harcoded variables in CMakeLists.
Also make sure you have Google ANGLE used as a library if you want to run it on the desktop.
I haven't spent much time cleaning stuff up since I am under pressure to get things working (as in launch the game) before this year's end, but if you think some stuff should be changed, tell me here and I'll try to make those changes as soon as schedule permits (usually weekends).
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [Android] OgreSamples for Android released

Post by dark_sylinc »

I see. Thanks!
I'm using 14b. The trivial errors are actually big security issues so I may prefer this NDK and fix them.

Right now it's complaining that EGLSupport is pure virtual class (thus new EGLSupport() fails), as newWindow is never overloaded. I may just fix that myself with a stub.
Hotshot5000
OGRE Contributor
OGRE Contributor
Posts: 226
Joined: Thu Oct 14, 2010 12:30 pm
x 56

Re: [Android] OgreSamples for Android released

Post by Hotshot5000 »

dark_sylinc wrote:I see. Thanks!
I'm using 14b. The trivial errors are actually big security issues so I may prefer this NDK and fix them.

Right now it's complaining that EGLSupport is pure virtual class (thus new EGLSupport() fails), as newWindow is never overloaded. I may just fix that myself with a stub.
Hmmm... I remember having the same problem. I can't remember what I did though. I'll look over some commits when I get home.

OK. Looks like I missed adding a file to the repo. See now with the latest version.
Post Reply