An attempt to do a Android port

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

ironsteel
Just popping in
Just popping in
Posts: 7
Joined: Fri Aug 31, 2012 15:09

An attempt to do a Android port

Postby ironsteel » Fri Aug 31, 2012 15:32

Hi CEGUI community.

I'm currently interested in porting CEGUI to Android. So far a have successfully built the GLES1 render module and the core CEGUI modules and I have a simple demo running (the OpenGLESTest Demo).

I want to point out that at the moment building is not very user friendly and is not documented.

I'm thinking to try do write a ResourceProvider that reads for the android asset directory and eventually write a GLES2 Renderer Module.

So i'm asking what are your thoughts about the proposal i'm giving ?

I have created a fork on github: https://github.com/ironsteel/cegui Checkout the android branch if you want to see the mess :)

I will also publish the source for the demo soon.

P.S. If you have some questions on the details, fell free to ask :)

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: An attempt to do a Android port

Postby Kulik » Sat Sep 01, 2012 08:27

Cool!

I wanted to play with a port of CEGUI to Android at some point but I have no hardware with Android at all :-)

Keep in mind that CEGUI is still very keyboard/mouse oriented and touch input has to be hacked around a bit. We do want to improve that at some point but it won't happen for CEGUI 1.0

PS: I wonder what this is and whether it will pose any difficulty when merging your stuff back to upstream CEGUI repository - https://github.com/ironsteel/cegui/comm ... 5eaad3f1c6

ironsteel
Just popping in
Just popping in
Posts: 7
Joined: Fri Aug 31, 2012 15:09

Re: An attempt to do a Android port

Postby ironsteel » Sat Sep 01, 2012 08:42

Well I'm actually fixing the mess right now, I may have some questions regarding the CMake Scripts, but they will popup soon.

As for the touch support, yes it will be a little challenging. I'll merge the default branch from sourceforge as soon as possible.

P.S. If you have any suggestions (critics), throw them at me :)

User avatar
Ident
CEGUI Team
Posts: 1868
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: An attempt to do a Android port

Postby Ident » Sat Sep 01, 2012 12:13

OpenGL ES 2 specification is pretty close to OpenGL desktop 3.2 Core Profile, i wrote the OpenGL 3.2 Core Profile compatible renderer (OpenGL3Renderer) for cegui. It is based on the OpenGL renderer and i changed everything needed to remove all deprecated code, so you might wanna look at it when you do the OpenGL ES 2 renderer for android.
Additionally i recommend you to use the glm lib for that case - it is headers only and you should be able to compile this on android afaik. This is also used in the OGL3 Renderer because you need it for matrix stacks and calculations etc etc.

I hope this is helpful for you
CrazyEddie: "I don't like GUIs"

ironsteel
Just popping in
Just popping in
Posts: 7
Joined: Fri Aug 31, 2012 15:09

Re: An attempt to do a Android port

Postby ironsteel » Sat Sep 01, 2012 12:31

Thanks for the useful information about the OpenGL3 <-> GLES2 similarity. I've already used glm in a simple project for android using GLES2, so is should not be a problem.

ironsteel
Just popping in
Just popping in
Posts: 7
Joined: Fri Aug 31, 2012 15:09

Re: An attempt to do a Android port

Postby ironsteel » Tue Sep 04, 2012 08:14

Hi, I have cleaned up the mess in a new branch.
You can see the diff comparing the master branch here: https://github.com/ironsteel/cegui/compare/master...android-port

Tell me if you have some remarks on what i have done so far.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: An attempt to do a Android port

Postby CrazyEddie » Mon Sep 10, 2012 07:44

The changes in the linked diff look pretty minimal - so that's cool. The only thing that IMO you should not be doing is specifying the EGL lib name explicitly in the 'cegui_target_link_libraries' line - if it's not working without that then I think the OpenGLES 'find' module should be fixed so that the appropriate libs are put in the variable (then it should be handled via the 'cegui_add_dependency' macro.

CE.

ironsteel
Just popping in
Just popping in
Posts: 7
Joined: Fri Aug 31, 2012 15:09

Re: An attempt to do a Android port

Postby ironsteel » Thu Sep 13, 2012 18:56

Hi, I've added a cmake script for finding EGL and then including it to the list of dependencies for the OpenGLES Renderer Module.

You can see the diff: https://github.com/ironsteel/cegui/compare/master...android-port

You can ignore my bash helper scripts. Well you can look at the build_android.sh script which invokes cmake for configuring.

For the cmake configuration step i'm using the android-cmake-toolchain for projects that use cmake, which then compiles them with the android ndk toolchain.

I'have a question:
Is it possible to tell cmake to search for the dependencies in other dir's. I've seen that the main CMakeLists.txt has a option for Win32 and MACOS, i've tried it but no result.
I'm asking the question because right now I'm copying the deps (freeimage, freetype, iconv, tinyxml) to the android toolchain directory in the appropriate dir for the platform and architecture, which is not the right way I think.

OGRE has this option in there cmake scripts when building for MACOS, WIN, ANDROID. I have looked there script, but I can't quite understand it, because i'm not very familiar with cmake.

So any pointers on this ?

Thanks in advance.

ironsteel
Just popping in
Just popping in
Posts: 7
Joined: Fri Aug 31, 2012 15:09

Re: An attempt to do a Android port

Postby ironsteel » Fri Jan 04, 2013 21:55

Happy New Year CEGUI community ! :pint:

It's been a while since I've last wrote my last forum post.

I have written some how to's on how to build CEGUI and run the sample application on android.

I have solved the issue with the dependencies search in CMake. The problem was in the cmake toolchain. I've copied the cmake toolchain file from the OGRE project.

You can see the diff for CEGUI changes here: https://github.com/ironsteel/cegui/compare/master...android-port#files_bucket

I have made some changes to the CMakeLists.txt file and added a parameter to the OpenGLES renderer bootstrapSystem() method for passing a custom resource provider for reading from the android assets directory.

You can find the instructions for building CEGUI here: https://github.com/ironsteel/cegui/blob/android-port/README.md
And the instructions for building the demo app here: https://github.com/ironsteel/cegui-android-test/blob/master/README.md
There are little bit frustrating but they will be improved.
If you have problems shout them loud to me :)

Next thing I will try is to build and run some of the more bigger examples from the example framework.

Once again if you have some suggestions or critics please throw them at me :)

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: An attempt to do a Android port

Postby CrazyEddie » Thu Jan 10, 2013 09:48

Happy new year to you, too.

Still don't have an android device to test any of this on :lol: But looking at your commits makes me feel bad, because I am reminded that I always forget to update the GLES Renderer module whenever I change the CEGUI::Renderer interface :oops:

Hopefully later this year (maybe before the fabled CEGUI 1.0 release) we can get these changes merged :)

ironsteel
Just popping in
Just popping in
Posts: 7
Joined: Fri Aug 31, 2012 15:09

Re: An attempt to do a Android port

Postby ironsteel » Fri Jan 11, 2013 16:54

Still don't have an android device to test any of this on

You can test it on the android emulator, I have written instructions for how to run the sample on the emulator here: https://github.com/ironsteel/cegui-android-test/blob/master/README.md.

But looking at your commits makes me feel bad,

I'm sorry for the introduced parameter in the bootstrap method, needed to pass my custom resource provider.
If you can point me how can i set a custom resource provider without modifying the code. I have searched the sources for such an option, but didn't find any. I should look again because I may be missing something.

As for the android sample app, it needs some fixes, cause i'm not handling right the lifecycle android callbacks and some other things (can't remember right now :D).

A question out of curiosity, are others interested in this port ? I'm not giving it up, just asking. I'm doing this just for fun, not for any particular usage, but might come up with one for future projects. :)

This is for now, I will continue to write here if I have missed something :)

Cheers

Hotshot5000
Just popping in
Just popping in
Posts: 1
Joined: Tue Feb 12, 2013 18:16

Re: An attempt to do a Android port

Postby Hotshot5000 » Tue Feb 12, 2013 18:38

A little history: I have started porting Ogre to android, rewriting it in java. Most of it is now done and have released a game that uses an engine with the Ogre renderer. Until now I have used the basic overlays that Ogre provides for GUI but I would like to add CEGUI instead.

Since I am not planning to rewrite this one in java the only option is to use it with the NDK and adapt it to the android requirements. Since the Ogre part is java and CEGUI is C++ I will have to use SWIG and maybe GWIS to make them communicate.

I have just started looking thorough CEGUI docs so I am not yet familiar with the project, but as I get up to speed I may be able to contribute to the android C++ port. From what I understand the big thing is the multi touch support that is not integrated in CEGUI. I am intending to release the game on PC and not limit myself to android so the android port should keep the mouse and keyboard parts intact. Is this the intended goal of CEGUI android port?


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest