[Android] OgreSamples for Android released

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
Hotshot5000
OGRE Contributor
OGRE Contributor
Posts: 154
Joined: Thu Oct 14, 2010 12:30 pm
x 2

[Android] OgreSamples for Android released

Post by Hotshot5000 » Mon Jan 30, 2017 3:08 pm

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.
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3997
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 192
Contact:

Re: [Android] OgreSamples for Android released

Post by dark_sylinc » Tue Jan 31, 2017 3:46 am

That is awesome!

I should clone your fork... and try it myself! (I'm so busy right now!! :cry: )
0 x

Seranth
Gnoblar
Posts: 15
Joined: Mon Jul 11, 2016 1:50 am

Re: [Android] OgreSamples for Android released

Post by Seranth » Tue Apr 11, 2017 10:57 pm

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%?
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3997
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 192
Contact:

Re: [Android] OgreSamples for Android released

Post by dark_sylinc » Tue May 30, 2017 10:53 pm

@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?
0 x

Hotshot5000
OGRE Contributor
OGRE Contributor
Posts: 154
Joined: Thu Oct 14, 2010 12:30 pm
x 2

Re: [Android] OgreSamples for Android released

Post by Hotshot5000 » Thu Jun 01, 2017 5:05 pm

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).
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3997
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 192
Contact:

Re: [Android] OgreSamples for Android released

Post by dark_sylinc » Thu Jun 01, 2017 5:21 pm

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.
0 x

Hotshot5000
OGRE Contributor
OGRE Contributor
Posts: 154
Joined: Thu Oct 14, 2010 12:30 pm
x 2

Re: [Android] OgreSamples for Android released

Post by Hotshot5000 » Fri Jun 02, 2017 2:11 pm

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.
0 x

Post Reply