Irrlicht on Android

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
guite
Posts: 3
Joined: Sun Mar 05, 2017 9:49 pm

Irrlicht on Android

Post by guite »

Hello everyone,

I am currently trying to find a documentation on how to run irrlicht on Android. I’ve found several threads on the web talking about a port of irrlicht on Android but sadly, everything I tried led me to a dead end… Is there an official documentation for running irrlicht in an android activity ? I couldn’t find any topic about Android in Irrlicht documentation nor in the wiki (did I try hard enough ? :-) ).

The best I could do was downloading the ogl-es branch of irrlicht, but when I tried compiling the example 17.Helloworld_mobile in visual, the project failed because another required project (..\..\source\Irrlicht\Irrlicht_mobile6.vcproj) was not found.

I was also wondering if I could use something like SWIG for wrapping irrlicht in java (objective-C) and using it in an Android (or iOS) app but I wonder how to create a irrlicht::device from an android view (or iOS view) ; is it possible ? Is there a documentation on how to do this ?

If anyone can give information on any of those questions, it is more than welcome :-)

PS: Even if I tried compiling irrlicht/ogl-es on windows/visual, I’d rather have a documentation that explains how to do so on linux (I use Ubuntu a lot more).

Regards,
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht on Android

Post by CuteAlien »

Sorry, it seems something got messed up on our svn server recently. I just noticed there is suddenly a new ogl-es branch in the main-folder which is outdated and wrong and doesn't even belong there. I suspect you used that one... sorry.... have to contact that developer and ask what this is about.

The correct ogl-es branch to use is the one in branches/ogl-es - and this version also includes an example (27.HelloWorld_Android) which comes with documentation for building the Android version.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
guite
Posts: 3
Joined: Sun Mar 05, 2017 9:49 pm

Re: Irrlicht on Android

Post by guite »

Oh OK, I was indeed trying to compile the branch ogl-es in the main svn folder >_<

Thank you very much for warning me, I’ll try the branch “branches/ogl-es” asap.

Regards,

EDIT:

It worked like a charm ! \o/
I had one compilation error due to the fact that the return type of the CAndroidAssetReader::read method hasn’t got the same type than its parent function IReadFile::read. Just in case someone would be interested, I would suggest this tiny diff:

Code: Select all

 
Index: source/Irrlicht/Android/CAndroidAssetReader.cpp
===================================================================
--- source/Irrlicht/Android/CAndroidAssetReader.cpp (révision 5364)
+++ source/Irrlicht/Android/CAndroidAssetReader.cpp (copie de travail)
@@ -36,14 +36,14 @@
        AAsset_close(Asset);
 }
 
-size_t CAndroidAssetReader::read(void* buffer, size_t sizeToRead)
+s32 CAndroidAssetReader::read(void* buffer, size_t sizeToRead)
 {
    int readBytes = AAsset_read(Asset, buffer, sizeToRead);
    if ( readBytes >= 0 )
        return size_t(readBytes);
Index: source/Irrlicht/Android/CAndroidAssetReader.h
===================================================================
--- source/Irrlicht/Android/CAndroidAssetReader.h   (révision 5364)
+++ source/Irrlicht/Android/CAndroidAssetReader.h   (copie de travail)
@@ -33,7 +33,7 @@
        /** \param buffer Pointer to buffer where read bytes are written to.
        \param sizeToRead Amount of bytes to read from the file.
        \return How many bytes were read. */
-       virtual size_t read(void* buffer, size_t sizeToRead);
+       virtual s32 read(void* buffer, size_t sizeToRead);
 
        //! Changes position in file
        /** \param finalPos Destination position in the file.
Index: examples/27.HelloWorld_Android/readme.txt
===================================================================
--- examples/27.HelloWorld_Android/readme.txt   (révision 5364)
+++ examples/27.HelloWorld_Android/readme.txt   (copie de travail)
@@ -18,7 +18,7 @@
 1. Assign your Android SDK path to an ANDROID_HOME environment variable.
 2. Add $ANDROID_HOME/tools and $ANDROID_HOME/platform-tools and the Android NDK main folder to your PATH environment variable.
 3. Go to: source->Irrlicht->Android and call "ndk-build" or "ndk-build NDEBUG=1"
-4. Go to: examples->27.HelloWorld_Mobile and call "ndk-build" or "ndk-build NDEBUG=1"
+4. Go to: examples->27.HelloWorld_Android and call "ndk-build" or "ndk-build NDEBUG=1"
 5. Call "ant debug" to create package
 6. Connect device to PC (with USB debugging mode ON) or turn on emulator.
 7. Call "adb -d install bin/HelloWorldMobile-debug.apk" (if you use emulator please add "-e" parameter instead of "-d") to install package on your device/emulator.
The last change being just a tiny tiny consistency problem.

Regards,
Post Reply