Native Android port

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.

Native Android port

Postby gsfare » Fri Jun 15, 2012 5:16 pm

Hi All,

I'm currently in the process of porting IrrLicht to Android using native only code (so no Java involved). I was wondering if there was any interest in this, either from the Dev's or from the public? I know there is already a port to Android, but it looks very incomplete, unmaintained and uses Java. Please do correct me if I'm wrong, I'm open to constructive discussions!

It would only support Android devices running > Android 2.3, but this is quickly becoming the norm, the advantage being that there should be little modification required to the examples in order to get them to run on a Android device.

Actually, if the stand alone toolset is used (built using google's tools from NDK) there is actually very little needed to be done to the build system.

So far I have a CIrrDeviceAndroid interface working with the COGLESDriver. There is still much todo but I am making good progress, especially seeing as I haven't had much experience of the IrrLicht engine yet.
Last edited by gsfare on Sat Jun 16, 2012 9:50 pm, edited 1 time in total.
gsfare
 
Posts: 4
Joined: Fri Jun 15, 2012 5:06 pm
Location: England

Re: Native Android port

Postby Nadro » Fri Jun 15, 2012 10:16 pm

Excellent info :) I'm currently working of it too (this is my priority on TODO list), but I have some exams on my high school and in last and next week I don't have too much time. Please public Your code and we'll put this to an official OGLES branch quickly. After 1.8 will be released we'll integrate OGLES branch with a trunk. Please inform me which parts of code You will do and which You will leave for me.
Nadro
 
Posts: 1647
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Native Android port

Postby gsfare » Sat Jun 16, 2012 10:39 am

At the moment I'm mostly concentrating on filling in the CIrrDeviceStub for Android, primarily the interaction between the way the Android OS can pause/hide -> show/resume execution of any apps and also the construction and destruction within the Android environment. I've had to make a small hack for now so I can develop the CIrrDeviceAndroid interface and that is to add a void * variable to SIrrlichtCreationParameters. This is to holds a pointer to the Android native glue structure (struct android_app *)that give access to the Java Android activity from native code. Since there is no real main(int, char**) function when building NDK code, as it's really in the Java world, I haven't worked out another method of passing this to the CIrrDeviceAndroid...yet. I'll come back to it, maybe someone else with better experince with the engine can offer some advice? So at the moment I need to use createDviceEx() instead of createDevice().

After that I'll make sure the OGLES driver is working and then add some form of touch screen input using a CCursorControl I guess, I've looked into it briefly, but that should be easy once all of the Android native activity abstraction is put into CIrrDeviceAndroid.
gsfare
 
Posts: 4
Joined: Fri Jun 15, 2012 5:06 pm
Location: England

Re: Native Android port

Postby gsfare » Sat Jun 16, 2012 12:52 pm

...is it worth posting any patches of current work so people can code review/comment?
gsfare
 
Posts: 4
Joined: Fri Jun 15, 2012 5:06 pm
Location: England

Re: Native Android port

Postby gsfare » Sat Jun 16, 2012 9:49 pm

I have the 01.HelloWorld and 03.CustomSceneNode examples working now. It's pretty much a cut and paste of the existing code so I'm pleased so far. Touch screen events are hooked in and working, both single and multi touch. The Quake map examples aren't working yet. I'll look into those.

Something else that needs to be worked out is the way pause/resume should be implemented. For now, I'd propose using a postEventFromUser() from CIrrDeviceAndroid. The users app can then deal with the pause and resume events and restore any logic that was previously saved. It's really only a mobile device feature, I'll check how the iOS implementation does it...

The next step I guess is to work on the file system next so I can test some of the examples that use texture mapping and model loading. I suppose the virtual filesystem should be adapted to use the Android APK file and allow access to the assets. Just thinking out loud at the moment...
gsfare
 
Posts: 4
Joined: Fri Jun 15, 2012 5:06 pm
Location: England

Re: Native Android port

Postby Nadro » Fri Jun 22, 2012 11:59 pm

Can You upload somewhere Your files? You already ported many things as You said, so does not make sense to wrote it again by me. Now I have some free time, so I can improve some Irrlicht's parts. I can help You with this Android port or start developing OGL3 driver. Android is my priority, so I will want to help You with this port at first.

BTW. For MultiTouch support we should use existing SMultiTouchInput structure in current OGL-ES branch.
Nadro
 
Posts: 1647
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Native Android port

Postby hiker » Thu Aug 16, 2012 11:54 am

Hi,

any updates on this? I have started at porting an irrlicht-based game to android, and so far have found three ports in various threads on the forum and elsewhere (well, this one would actually be the fourth), plus the ogl-es branch.

I would really prefer focusing on a branch/port that has some chance to be integrated into trunk.

Cheers,
Joerg
hiker
 
Posts: 58
Joined: Thu May 31, 2007 5:12 am

Re: Native Android port

Postby hybrid » Thu Aug 16, 2012 12:31 pm

The ogl-es branch is always the base. Here, mostly the device aspect is under discussion. Because we need access to keyboard, touch inputs, etc. And these things have not been part of the branch (unless some other device, such as X11 could be used). The ogl-es branch will be merged as Irrlicht 1.9.
hybrid
Admin
 
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Re: Native Android port

Postby Nadro » Sat Aug 18, 2012 5:56 pm

I have worked some Android code, but I still didn't merge it with a branch. I was on holiday, but today I returned :) If You would help me with this port please write PM to me. If You don't have too much time for it please leave it for me, I wanna to finish this port to 10 september :P
Nadro
 
Posts: 1647
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Native Android port

Postby sundagy » Thu Jan 03, 2013 10:47 pm

Hi Nadro, is there any progress?
User avatar
sundagy
 
Posts: 2
Joined: Thu Jan 03, 2013 10:00 pm

Re: Native Android port

Postby Nadro » Thu Jan 03, 2013 11:18 pm

Yes (thanks to hiker and gsfare), please check ogl-es branch, it support Android platforms (OGL ES1 driver is recommended, because ES2 driver is still bugged).
Nadro
 
Posts: 1647
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Native Android port

Postby sundagy » Mon Jan 07, 2013 10:37 pm

Nadro wrote:Yes (thanks to hiker and gsfare), please check ogl-es branch, it support Android platforms (OGL ES1 driver is recommended, because ES2 driver is still bugged).


What exactly not working there in GLES2? I am will try to fix it, so please give me complete project with example where glitches would be clearly seen.

Also I noticed that there appeared classes CAndroidAssetReader and CAndroidAssetFileArchive, they are already work properly?
If yes, could you provide a small example of how to use them?

And last question, at this stage this branch is supports retrieving events from device - (multi)touch, buttons, accelerometer?
User avatar
sundagy
 
Posts: 2
Joined: Thu Jan 03, 2013 10:00 pm

Re: Native Android port

Postby hiker » Mon Jan 07, 2013 11:06 pm

sundagy wrote:Also I noticed that there appeared classes CAndroidAssetReader and CAndroidAssetFileArchive, they are already work properly?
If yes, could you provide a small example of how to use them?

They are working as good as it might get I'd say (android's API does not return subdirectory names, so getFileList only returns files). There is a CAndroidAssetFileArchive class, which uses the reader. The one example I hacked together is example 08:
  • Import example 08 into eclipse
  • create a media subdirectory under assets (the assets directory should have been created by the previous step).
  • copy axe.jpg dwarf.jpg dwarf.x fire.bmp particlewhite.bmp portal1.bmp portal2.bmp portal3.bmp portal4.bmp portal5.bmp portal6.bmp portal7.bmp room.3ds stones.jpg wall.jpg water.jpg from irrlicht's media directory into assets/media
  • compile using ndk-build
  • Run using eclipse
No need to use a memory card with the assets anymore ;) The assets file system is added to the list of file systems by the android device, and it will try to read all files starting with /assets (kind of a virtual file system, since obviously there is no /assets directory ;) ). So there should be no need to actually use it, just use the standard irrlicht file system and read files from "/assets".

Note that I had to revert some part of r4311 - the files under aesGladman do not compile with android anymore (I had to add the "#include <string.h>" back), and Nadro haven't had the time to fix that yet.

And last question, at this stage this branch is supports retrieving events from device - (multi)touch, buttons, accelerometer?

There is some code in it, but I am not sure how much all of it is working. The example 08 reacts to touching the screen, though it's hard (nearly impossible) to control it imho ;)

Cheers,
Joerg
hiker
 
Posts: 58
Joined: Thu May 31, 2007 5:12 am

Re: Native Android port

Postby mazataza » Wed Jan 16, 2013 7:53 am

Nadro wrote:Yes (thanks to hiker and gsfare), please check ogl-es branch, it support Android platforms (OGL ES1 driver is recommended, because ES2 driver is still bugged).


I am new to Irrlicht and tried yesterday to compile ogl-es branch with android but I get some compile errors .
for example got some errors by sources in "aesGladman" which could not found memset method I addedd "string.h" as include to get arround this error.
then some files located in "Android.mk" are not in source code like COGLES2FixedPipelineShader.cpp which is not exist in code.

I brake the build yesterday but i should go to bed as it was 1:00. I will try it today. But you guys no any hints on how to compile it. what i should change to get build with OGL ES1.
mazataza
 
Posts: 17
Joined: Wed Jan 16, 2013 7:36 am
Location: Karlsruhe, Germany

Re: Native Android port

Postby Nadro » Wed Jan 16, 2013 3:29 pm

I'll fix build system today ;)
Nadro
 
Posts: 1647
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Next

Return to Open Discussion and Dev Announcements

Who is online

Users browsing this forum: No registered users and 1 guest