Android Port

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Android Port

Post by mongoose7 »

Looks as if the floating point precision is too low.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Android Port

Post by hendu »

Yep, seems like you're using a 16-bit or 8-bit depth buffer. Does your device offer higher precision?
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Android Port

Post by ent1ty »

The supported depth buffer precision should be at least 16 bits if not 24(nexus 7, nothing ancient), I think that should be quite sufficient for near/far values of 1.0/2000.0(irrlicht default). However it seems like i'm getting a 8-bit one instead. I tried various settings in SIrrlichtCreationParams::ZBufferBits but it seems to have no effect(no difference at all between 8, 16 or 24)
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Android Port

Post by ent1ty »

Just a small detail, Android.mk in the example 17.HelloWorldMobile shipped with the ogl-es branch links with irrlicht like this:

Code: Select all

 
LOCAL_LDLIBS := -L$(LOCAL_PATH)/../../lib/Android -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid -lIrrlicht
android ndk(r9) complains about this, warning this is likely to result in incorrect build. It seems to work anyway, but just to be on the safe side, I figured out how you're really supposed to link with prebuilt libs:

Code: Select all

 
LOCAL_PATH := $(call my-dir)/..
IRRLICHT_PROJECT_PATH := $(LOCAL_PATH)
 
include $(CLEAR_VARS)
LOCAL_MODULE := Irrlicht
LOCAL_SRC_FILES := -L$(LOCAL_PATH)/../irrlicht-4565/lib/Android/libIrrlicht.a
include $(PREBUILT_STATIC_LIBRARY)
 
#actual config for your app begins here
include $(CLEAR_VARS) 
...
...
...
LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid
LOCAL_STATIC_LIBRARIES := android_native_app_glue Irrlicht
...
 
Cheers :)
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

Thanks for info, it will be improved in next update.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

In latest commit one major issue was fixed - OpenGL context lost when application was paused and next resumed. Currently only OGLES1 driver is supported, but it'll be fixed tomorrow. In next few days Android support should be improved a lot.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
cww
Posts: 27
Joined: Sun Jul 28, 2013 1:29 pm

Re: Android Port

Post by cww »

Hi Nadro, this is great news for me. Thanks for the work!
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

I found 2 issues with current code:
- Application crash at resume (when Application was locked).
- MultiTouch event UP doesn't work properly.

I'll fix these issues today ;) If you will find some other issues please report it.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
cww
Posts: 27
Joined: Sun Jul 28, 2013 1:29 pm

Re: Android Port

Post by cww »

Hi Nadro, not really a bug report, but if the following can be added to the constructor of CIrrDeviceAndroid, it will be good.

Code: Select all

 
        // after do {…} while(!Initialized);
    CreationParams.WindowSize.Width = (CreationParams.WindowSize.Width > 0) ? CreationParams.WindowSize.Width : ANativeWindow_getWidth(Android->window);
    CreationParams.WindowSize.Height = (CreationParams.WindowSize.Height > 0) ? CreationParams.WindowSize.Width : ANativeWindow_getHeight(Android->window);
 
If user specified w=0 and h=0 when creating the device, the constructor can then use the screen width and height, which is available after the do {…} while loop, to initialise.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

Yep, I thought about similar functionality. I'll add it in the next commit :) Currently iOS use similar solution for set native resolution.

BTW. Issues from my previous post are already fixed.

UPDATE:
I already applied changes related to set native window resolution when window size creation params are equals to 0.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
cww
Posts: 27
Joined: Sun Jul 28, 2013 1:29 pm

Re: Android Port

Post by cww »

Hi Nadro, thanks for the good work. I am refactoring my own code a bit with the latest changes and have the following thoughts…

For android onAppCmd callback, my app also needs to be notified (to save state persistently, for example), but the event already handled within CIrrDeviceAndroid. As a work around, I assign a new callback to android_app after CIrrDeviceAndroid is created. CIrrDeviceAndroid still needs to handle the event so I call irr::CIrrDeviceAndroid::handleAndroidCommand within my new callback. See below.

Code: Select all

 
m_pDevice = static_cast<IrrlichtDevice*>(new CIrrDeviceAndroid(param));
// use a custom onAppCmd callback
android_app* android = (android_app*)(param.PrivateData);
android->onAppCmd = customCallback;
 
…
 
void customCallback(android_app* app, int32_t cmd)
{
        // my code goes here
        ……
        // call original irrlicht callback function
    irr::CIrrDeviceAndroid::handleAndroidCommand(app, cmd);
}
 
A bit hackish but it works. One last problem is irr::CIrrDeviceAndroid::handleAndroidCommand is private, and I need to change in irrlicht source code to make it public. Hence if this function can be made public, or some other mechanism can be added for our own callback be triggered, it will be great!

Cheers!
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

Hi, In future it should be solbed is some more user friendly way, but at this time this solution looks very well. Thanks for it, I'll change this command to public method in next commit.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

I marked 2 static methods (input + commands) as public in last commit ;)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Android Port

Post by ent1ty »

I'm providing nightly builds of the ogl-es branch with latest android ndk (r9b) here.

These are untested, so please contact me if anything seems wrong (you can pm me here on the forums, but I also usually hang out in #irrlicht on freenode).
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
Neirdan
Posts: 39
Joined: Tue Aug 14, 2012 10:29 pm

Re: Android Port

Post by Neirdan »

I've started using the android port today on my HTC One, compiling from Windows 7.
A few things:
-By default, you should switch from:

Code: Select all

param.WindowSize = dimension2d<u32>(480,854);
to:

Code: Select all

param.WindowSize = dimension2d<u32>(0,0);
because someone added in CIrrDeviceAndroid:

Code: Select all

 
if (Device->CreationParams.WindowSize.Width == 0 || Device->CreationParams.WindowSize.Height == 0)
            {
                Device->CreationParams.WindowSize.Width = ANativeWindow_getWidth(app->window);
                Device->CreationParams.WindowSize.Height = ANativeWindow_getHeight(app->window);
            }
 
Regarding jni/Android.mk
-These command don't work because cp doesn't exist on windows (and mkdir doesn't seem to work either).

Code: Select all

 
#$(shell mkdir -p $(IRRLICHT_PROJECT_PATH)/assets)
#$(shell mkdir -p $(IRRLICHT_PROJECT_PATH)/assets/media)
#$(shell mkdir -p $(IRRLICHT_PROJECT_PATH)/assets/media/Shaders)
#$(shell mkdir -p $(IRRLICHT_PROJECT_PATH)/src)
#$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/Shaders/*.* $(IRRLICHT_PROJECT_PATH)/assets/media/Shaders/)
#$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/irrlichtlogo3.png $(IRRLICHT_PROJECT_PATH)/assets/media/)
#$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/sydney.md2 $(IRRLICHT_PROJECT_PATH)/assets/media/)
#$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/sydney.bmp $(IRRLICHT_PROJECT_PATH)/assets/media/)
 
Question: as stated above, I'm on an HTC One, which is a hdpi device and the fonts are really incredibly small. Is it something that has to be fixed in the irrlicht render or is it something bound to the android view?
Post Reply