Android Port

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
CuteAlien
Admin
Posts: 9652
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android Port

Post by CuteAlien »

OK, I give up - I find no reason why it would behave like that. If it's fine with Nadro I can add that as workaround - I mean having 1,1 is probably never correct (unless there are single-pixel devices...) so adding that shouldn't be a problem. We'll just add a comment that it's a hack for unexplainable HTC one behavior and hope someone figures out the real reason at some point.
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
mikkis
Posts: 64
Joined: Mon Jan 28, 2013 2:38 pm
Location: Fi

Re: Android Port

Post by mikkis »

CuteAlien wrote:HTC one behavior
Samsung galaxy mini is the one which shows that 1,1.
CuteAlien
Admin
Posts: 9652
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android Port

Post by CuteAlien »

Oops right - the HTC ONE was Neirdan's phone.
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
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

I'll check this problem tomorrow.
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 »

Can you check how window width and height values looks in APP_CMD_WINDOW_RESIZED state? Eg change line 206 in CIrrDeviceAndroid.cpp from:

Code: Select all

case APP_CMD_INIT_WINDOW:
to

Code: Select all

case APP_CMD_WINDOW_RESIZED:
BTW. This is nice whitepaper related to Android apps lifecycle: https://developer.nvidia.com/sites/defa ... p_note.pdf
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
BinMa
Posts: 19
Joined: Wed Feb 19, 2014 8:59 am

Re: Android Port

Post by BinMa »

I've met the same white screen in My API level9 devices(SumSung GT-I9000).
@Nadro, It seems APP_CMD_WINDOW_RESIZED is never received during the application's initialization. And which is interesting is that when APP_CMD_WINDOW_INIT received,the height and width is 1, but in later APP_CMD_GAINED_FOCUS event, the height and width are correct;
02-20 19:57:25.535: V/threaded_app(3910): Creating: 0x292248
02-20 19:57:25.542: V/threaded_app(3910): Config: mcc=460 mnc=2 lang=zh cnt=CN orien=1 touch=3 dens=240 keys=1 nav=1 keysHid=3 navHid=0 sdk=10 size=2 long=2 modetype=1 modenight=1
02-20 19:57:25.542: I/Irrlicht(3910): Irrlicht Engine version 1.9.0
02-20 19:57:25.546: V/threaded_app(3910): Start: 0x292248
02-20 19:57:25.558: I/Irrlicht(3910): Waiting for Android activity window to be created.
02-20 19:57:25.558: V/threaded_app(3910): activityState=10
02-20 19:57:25.566: V/threaded_app(3910): Resume: 0x292248
02-20 19:57:25.570: V/threaded_app(3910): activityState=11
02-20 19:57:25.574: I/Irrlicht(3910): Android command APP_CMD_RESUME
02-20 19:57:25.593: V/threaded_app(3910): InputQueueCreated: 0x292248 -- 0x293608
02-20 19:57:25.593: V/threaded_app(3910): APP_CMD_INPUT_CHANGED
02-20 19:57:25.593: V/threaded_app(3910): Attaching input queue to looper
02-20 19:57:25.628: V/threaded_app(3910): NativeWindowCreated: 0x292248 -- 0x293a58
02-20 19:57:25.648: V/threaded_app(3910): APP_CMD_INIT_WINDOW
02-20 19:57:25.648: V/threaded_app(3910): WindowFocusChanged: 0x292248 -- 1
02-20 19:57:25.660: I/Irrlicht(3910): Android command APP_CMD_INIT_WINDOW
02-20 19:57:25.660: I/Irrlicht(3910): init window = 0x293a58
02-20 19:57:25.660: I/Irrlicht(3910): init window height = 1, width = 1

02-20 19:57:25.660: D/libEGL(3910): loaded /system/lib/egl/libEGL_POWERVR_SGX540_120.so
02-20 19:57:25.664: D/libEGL(3910): loaded /system/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
02-20 19:57:25.675: D/libEGL(3910): loaded /system/lib/egl/libGLESv2_POWERVR_SGX540_120.so
02-20 19:57:25.726: I/Irrlicht(3910): EGL version: 1.400000
02-20 19:57:25.804: I/Irrlicht(3910): Using renderer: OpenGL ES-CM 1.1
02-20 19:57:25.804: I/Irrlicht(3910): Imagination Technologies
02-20 19:57:25.804: I/Irrlicht(3910): GL_OES_byte_coordinates GL_OES_fixed_point GL_OES_single_precision GL_OES_matrix_get GL_OES_read_format GL_OES_compressed_paletted_texture GL_OES_point_sprite GL_OES_point_size_array GL_OES_matrix_palette GL_OES_draw_texture GL_OES_query_matrix GL_OES_texture_env_crossbar GL_OES_texture_mirrored_repeat GL_OES_texture_cube_map GL_OES_blend_subtract GL_OES_blend_func_separate GL_OES_blend_equation_separate GL_OES_stencil_wrap GL_OES_extended_matrix_palette GL_OES_framebuffer_object GL_OES_rgb8_rgba8 GL_OES_depth24 GL_OES_stencil8 GL_OES_compressed_ETC1_RGB8_texture GL_OES_mapbuffer GL_OES_EGL_image GL_EXT_multi_draw_arrays GL_OES_required_internalformat GL_IMG_read_format GL_IMG_texture_compression_pvrtc GL_IMG_texture_format_BGRA8888 GL_EXT_texture_format_BGRA8888 GL_IMG_texture_stream GL_OES_egl_sync GL_IMG_vertex_array_object
02-20 19:57:25.824: I/Irrlicht(3910): Android command APP_CMD_GAINED_FOCUS
02-20 19:57:25.824: I/Irrlicht(3910): focus window = 0x293a58
02-20 19:57:25.824: I/Irrlicht(3910): init window height = 800, width = 480

02-20 19:57:25.824: I/Irrlicht(3910): Window size:(480/800)
02-20 19:57:25.824: I/Irrlicht(3910): Display size:(480/800)
why is the window size changed without a APP_CMD_WINDOW_RESIZED event?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

For me it looks like a bug in Galaxy software, but we can add some statement in APP_CMD_GAINED_FOCUS to check if window size is different than in APP_CMD_INIT_WINDOW. It should solve this issue. Please check following code:

Code: Select all

case APP_CMD_GAINED_FOCUS:
     os::Printer::log("Android command APP_CMD_GAINED_FOCUS", ELL_DEBUG);
     {
          s32 surfaceWidth = ANativeWindow_getWidth(app->window);
          s32 surfaceHeight = ANativeWindow_getHeight(app->window);
 
          if (device->CreationParams.WindowSize.Width != surfaceWidth || device->CreationParams.WindowSize.Height != surfaceHeight)
          {
               device->getContextManager()->destroySurface();
               device->getContextManager()->generateSurface();
 
               device->CreationParams.WindowSize.Width = surfaceWidth;
               device->CreationParams.WindowSize.Height = surfaceHeight;
          }
     }
     device->Focused = true;    
break;
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
mikkis
Posts: 64
Joined: Mon Jan 28, 2013 2:38 pm
Location: Fi

Re: Android Port

Post by mikkis »

Seems to work now, thanks.
BinMa
Posts: 19
Joined: Wed Feb 19, 2014 8:59 am

Re: Android Port

Post by BinMa »

I‘m now handing IME related stuff. It seems to be impossible to make this part perfect just using native code. I can handle input method's opening, closing, typing US-ASCII key now, but for 'complex strings' inputs, we can never get the input strings from NDK side as is said here.
https://groups.google.com/forum/#!topic ... UbngNEKR5U
CuteAlien
Admin
Posts: 9652
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android Port

Post by CuteAlien »

@BinMa: Sounds bad. I've still not worked on input (fighting trouble with the filesystem and 3rd party libs right now - as well as some filesystem trouble with Irrlicht).
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
CuteAlien
Admin
Posts: 9652
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android Port

Post by CuteAlien »

@Nadro: That patch also looks good to me on first view. Will you apply it?
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
BinMa
Posts: 19
Joined: Wed Feb 19, 2014 8:59 am

Re: Android Port

Post by BinMa »

@CuteAlien
I’m afraid that patch is still incomplete. I meet black screen instead of white screen from time to time.
the error log is like
02-24 04:18:03.164: E/libEGL(5372): call to OpenGL ES API with no current context (logged once per thread)
After I add

Code: Select all

device->getContextManager()->activateContext(device->getContextManager()->getContext());
after the recreation of surface, it works properly.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

@CuteAlien
Yes, I'll check bug reported by BinMa and next I'll apply this patch (probably tomorrow).

@BinMa
For problems like a IME and other specific for NDK I prefer two activities - first transparent on top for input handling (JAVA + JNI -> Activity) and second with Irrlicht (C++ -> NativeActivity), however it require some changes in Irrlicht eg. disable input handling in Irrlicht and system commands forwarding from one activity to another.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
BinMa
Posts: 19
Joined: Wed Feb 19, 2014 8:59 am

Re: Android Port

Post by BinMa »

@Nadro
I choose to extend Native Activity and add some Java + JNI code to make IME works finally.
I'm not sure whether using one activity onto irrlicht activity will cause any focus problems and it seems to be a little complicated to forwarding all the events.
mikkis
Posts: 64
Joined: Mon Jan 28, 2013 2:38 pm
Location: Fi

Re: Android Port

Post by mikkis »

Something strange with the textures (it shows some random data, and right texturedata too).
I thought it was some bad lighting calculations but noticed that COGLES2FixedPipeline.fsh/vsh doesnt calculate light.

Image

Image

Image
Post Reply