Page 17 of 26

Re: Android Port

Posted: Sat Aug 24, 2013 5:50 am
by mongoose7
Looks as if the floating point precision is too low.

Re: Android Port

Posted: Sat Aug 24, 2013 7:43 am
by hendu
Yep, seems like you're using a 16-bit or 8-bit depth buffer. Does your device offer higher precision?

Re: Android Port

Posted: Sat Aug 24, 2013 11:31 am
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)

Re: Android Port

Posted: Sat Aug 24, 2013 2:20 pm
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 :)

Re: Android Port

Posted: Sun Aug 25, 2013 9:13 pm
by Nadro
Thanks for info, it will be improved in next update.

Re: Android Port

Posted: Thu Oct 17, 2013 11:18 pm
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.

Re: Android Port

Posted: Fri Oct 18, 2013 12:35 pm
by cww
Hi Nadro, this is great news for me. Thanks for the work!

Re: Android Port

Posted: Wed Oct 23, 2013 10:31 am
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.

Re: Android Port

Posted: Wed Oct 23, 2013 3:52 pm
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.

Re: Android Port

Posted: Wed Oct 23, 2013 4:32 pm
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.

Re: Android Port

Posted: Fri Oct 25, 2013 2:21 pm
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!

Re: Android Port

Posted: Mon Oct 28, 2013 8:54 am
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.

Re: Android Port

Posted: Wed Oct 30, 2013 9:41 am
by Nadro
I marked 2 static methods (input + commands) as public in last commit ;)

Re: Android Port

Posted: Sun Dec 01, 2013 7:33 pm
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).

Re: Android Port

Posted: Sun Jan 05, 2014 1:29 am
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?