Android Port

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

COGLESTexture doesn't need COGLES2ExtensionHandler, because these filer are prepared for 2 different drivers ES1 and ES2. For copy library you have to define ANDROID_HOME. Define it, and rebuild Irrlicht. Switched colors will be fixed soon. Example 08 and others require additional stuff, so make sure that you prepared properly code (similar to example 17).

BTW. Which phone are you use and which Android version?
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 »

Well, what about the low framerate on ogl es 2.0? Like I said, it's a Nexus 7 - i can play gta vice city there on >40 fps at all times, irrlicht quake 3 map demo on 14 is just plain unacceptable


Edit: also, how can you possibly compile everything correctly without including the COGLES2ExtensionHandler in COGLESTexture, if this is what COGLESTexture.cpp looks like:
//COGLESTexture.cpp
[...]
#ifndef GL_BGRA
    // whoa, pretty badly implemented extension...
    if (Driver->FeatureAvailable[COGLES2ExtensionHandler::IRR_IMG_texture_format_BGRA8888] ||
        Driver->FeatureAvailable[COGLES2ExtensionHandler::IRR_EXT_texture_format_BGRA8888] ||
        Driver->FeatureAvailable[COGLES2ExtensionHandler::IRR_APPLE_texture_format_BGRA8888])
        GL_BGRA = 0x80E1;
    else
        GL_BGRA = GL_RGBA;
#endif
[...]
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 posting a code. It's copy - paste bug, it should use COGLESExtensionHandler. Performance of built-in shaders are really bad thats, why I always say that for OGL ES2.0 everyone should prepare own shaders - dedicated for a game requirments, because emulate of fixed pipeline behaviour is just waste of GPU power. Anyway fixed pipeline shaders will be improved a lot in near future, because at now it use rg. 'discard' which is really bad for performance on mobile GPUs.
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 »

Omg, so that's why! I just checked the COGLES2FixedPipeline.fsh file, there's like 15 if checks there! You need to create a shader for each material, not check the material for EVERY pixel on screen, this is creating a HUGE slowdown, really it's not usable. Just don't use any if's in shaders, it's really bad for performance :)
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!
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Android Port

Post by hendu »

Feel free to post a shader that emulates the full fixed pipeline without any ifs. You clearly must be capable of writing one ;)
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post by Nadro »

"if" based on uniforms and const is cheap for most GPUs (eg. PowerVR arch), just "if" which use value calculated inside a shader is expensive, but we don't use them. The biggest slowdown is caused by discard. Just remove this keyword from a shader and you will see big performance increase in current shader. Switch material on CPU may be more expensive than switch based on if and uniform (depend on CPU + GPU config) and even if we will remove if for branch material, we will use them eg for lights etc. Fixed Pipeline shader isn't good choice, when shaders interface is available. We add support for Fixed Pipeline in ES 2.0 and DX11 just for built-in features compatibility reasons, not performance.
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 »

hendu wrote:Feel free to post a shader that emulates the full fixed pipeline without any ifs. You clearly must be capable of writing one ;)
My point was, just don't. Have a separate shader for each material. The way things are now, you check the material type for every pixel getting rendered. Not the most efficient solution, if you ask me :wink:


Nadro: are you sure about this? There is only a single discard in the shader - and it's for transparent material. Wouldn't the slowdown only occur when rendering a transparent material?
What discard does, I'm sure you know, it just throws away the current pixel. Usually this improves the fps, not the opposite. Of course, I don't know how's the situation on mobile GPUs. Does it really reduce fps? Do you have a link with some more info on this?
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!
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Android Port

Post by hendu »

http://www.imgtec.com/powervr/insider/d ... ternal.pdf

Deferred tiled renderers are quite different to desktop gpus.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Android Port

Post by ent1ty »

Thanks, that helps a lot. I tried removing discard from the fixed pipeline shader, this however didn't really help much - 16-17 fps vs the previous 14. So the main problem seems to be somewhere else. Maybe it's incorrectly using dynamic flow control, even though it shouldn't? I know when I removed all the if's(so just rendering everything as a a solid material), the fps went really high - i'm guessing its capped on 60 by android so i can't tell you the exact number.
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 »

We'll back to shaders perf in future. Currently I'm more focus on C++ ES 2.0 code than built-in GLSL, because GLSL may be replaced without any problems by end user, C++ sources not.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
shark_78
Posts: 1
Joined: Thu Jul 04, 2013 9:21 pm

Re: cannot bind texture on android 4.2

Post by shark_78 »

guqun wrote:
zhengxianfu wrote:This problem has been solved.

Code: Select all

 
COGLESTexture.cpp:getBestColorFormat: 
"destFormat=ECF_A1R5G5B5;" 
 
OR Invoke:
driver->setTextureCreationFlag(ETCF_ALWAYS_16_BIT,true);
 
Refer to http://irrlicht.sourceforge.net/forum/v ... 8&start=45 by Willem.
Thanks.
pmtolk wrote:01-07 03:11:10.684: INFO/log(28446): Irrlicht Engine version 1.7.0-beta
01-07 03:11:10.684: INFO/Irrlicht(28446): CIrrDeviceAndroid::CIrrDeviceAndroid
01-07 03:11:10.684: INFO/Irrlicht(28446): CIrrDeviceAndroid::createDriver
01-07 03:11:10.684: INFO/log(28446): Using renderer: OpenGL ES-CM 1.1
01-07 03:11:10.684: INFO/log(28446): Qualcomm
01-07 03:11:10.684: INFO/log(28446): GL_AMD_compressed_3DC_texture GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_APPLE_texture_2D_limited_npot GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_OES_blend_equation_separate GL_OES_blend_func_separate GL_OES_blend_subtract GL_OES_compressed_ETC1_RGB8_texture GL_OES_compressed_paletted_texture GL_OES_depth_texture GL_OES_draw_texture GL_OES_framebuffer_object GL_OES_matrix_palette GL_OES_packed_depth_stencil GL_OES_point_size_array GL_OES_point_sprite GL_OES_read_format GL_OES_rgb8_rgba8 GL_OES_stencil_wrap GL_OES_EGL_image GL_OES_texture_cube_map GL_OES_texture_env_crossbar GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_texture_mirrored_repeat GL_QCOM_binning_control GL_QCOM_extended_get GL_QCOM_tiled_rendering
01-07 03:11:10.694: INFO/log(28446): GL_INVALID_ENUM
01-07 03:11:10.694: INFO/log(28446): Could not bind Texture
01-07 03:11:10.694: INFO/Irrlicht(28446): createDevice r=3048792 w=320 h=480
01-07 03:11:10.694: INFO/Irrlicht(28446): getVideoDriver r=3049488
01-07 03:11:10.694: INFO/Irrlicht(28446): resize w=320 h=519
01-07 03:11:11.194: INFO/log(28446): Loaded mesh
01-07 03:11:11.214: INFO/log(28446): Loaded texture
01-07 03:11:11.214: INFO/Irrlicht(28446): add texture
01-07 03:11:11.214: INFO/Irrlicht(28446): beginScene

This is the complete Log Error

I encounter the same problem when using HTC G14 which also use qualcom ,texture doesn't render.

Does anyone know how to solve this problem?
Thanks in advance.

hi
i changed the code ,but sydney demo's texture is white.
did you meet this problem and reslove it?

Hi,
i have some problem, with android 4.2, irrlicht 1.7.0 beta with emulator.
My Sydney example work without texture binding, but texture was loaded (as you can see from logs)
Someone has solved this problem?
Thanks in advance.

07-04 21:12:43.093: I/log(7476): Irrlicht Engine version 1.7.0-beta
07-04 21:12:43.093: I/Irrlicht(7476): CIrrDeviceAndroid::CIrrDeviceAndroid
07-04 21:12:43.103: I/Irrlicht(7476): CIrrDeviceAndroid::createDriver
07-04 21:12:43.103: I/log(7476): OpenGL-ES2 initialized
07-04 21:12:43.103: I/Irrlicht(7476): OGLES2 initialized
07-04 21:12:43.113: I/log(7476): Using renderer: OpenGL ES 2.0 (2.1.8787)
07-04 21:12:43.113: I/log(7476): Google (ATI Technologies Inc.)
07-04 21:12:43.113: I/log(7476): GL_EXT_debug_marker GL_OES_EGL_image GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float
07-04 21:12:43.123: I/log(7476): load shader: /mnt/sdcard/Irrlicht/COGLES2FixedPipeline.vsh
07-04 21:12:43.123: I/log(7476): Loading shader
07-04 21:12:43.137: I/log(7476): Loading shader
07-04 21:12:43.544: I/log(7476): �X
07-04 21:12:43.594: I/log(7476): �X
07-04 21:12:43.594: I/log(7476): �X
07-04 21:12:43.594: I/log(7476): �X
07-04 21:12:43.594: I/log(7476): �X
07-04 21:12:43.594: I/log(7476): �X
07-04 21:12:43.603: I/log(7476): �X
07-04 21:12:43.603: I/log(7476): �X
07-04 21:12:43.603: I/log(7476): �X
07-04 21:12:43.603: I/log(7476): �X
07-04 21:12:43.603: I/log(7476): �X
07-04 21:12:43.603: I/log(7476): �X
07-04 21:12:43.603: I/log(7476): �X
07-04 21:12:43.603: I/log(7476): Shader loaded
07-04 21:12:43.603: I/log(7476): load shader: /mnt/sdcard/Irrlicht/COGLES2Renderer2D.vsh
07-04 21:12:43.603: I/log(7476): Loading shader
07-04 21:12:43.613: I/log(7476): Loading shader
07-04 21:12:43.663: I/log(7476): Shader loaded
07-04 21:12:43.683: I/log(7476): load shader: /mnt/sdcard/Irrlicht/COGLES2NormalMap.vsh
07-04 21:12:43.683: I/log(7476): Loading shader
07-04 21:12:43.693: I/log(7476): Loading shader
07-04 21:12:43.763: I/log(7476): �X�0�**��X�0�++�(..�
07-04 21:12:43.763: I/log(7476): �X�0�**��X�0�++�(..�
07-04 21:12:43.773: I/log(7476): Shader loaded
07-04 21:12:43.773: I/log(7476): load shader: /mnt/sdcard/Irrlicht/COGLES2ParallaxMap.vsh
07-04 21:12:43.783: I/log(7476): Loading shader
07-04 21:12:43.803: I/log(7476): Loading shader
07-04 21:12:43.893: I/log(7476): �X�0X,,��X�0�++�(..�
07-04 21:12:43.893: I/log(7476): �X�0X,,��X�0�++�(..�
07-04 21:12:43.893: I/log(7476): �X�0X,,��X�0�++�(..�
07-04 21:12:43.893: I/log(7476): Shader loaded
07-04 21:12:44.003: I/Irrlicht(7476): createDevice r=706253872 w=320 h=480
07-04 21:12:44.003: I/Irrlicht(7476): getVideoDriver r=706198608
07-04 21:12:44.013: I/Irrlicht(7476): resize w=320 h=483
07-04 21:12:45.373: I/log(7476): Loaded mesh
07-04 21:12:45.602: I/log(7476): Loaded texture
07-04 21:12:45.602: I/Irrlicht(7476): add texture
07-04 21:12:45.613: I/Irrlicht(7476): begin Scene
07-04 21:12:45.813: I/Irrlicht(7476): Sydney fps=1
leebojammin
Posts: 16
Joined: Thu Jun 15, 2006 8:45 pm

Re: Android Port

Post by leebojammin »

I"d love to see that IRR runs android, but very surprised to see nobody is posting actual screeshots of the phone ? I"d like to see that the phone is running it, so please could someone post this ( my phone isn't working right) instead of cropping the hell out of the edge ? o_0

Thx
leeboJ
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Android Port

Post by hybrid »

You can also just test some real android apps frm the market. I tested Stair dismount some days ago, quite nice. And really nice is also Cubory (lite), a very neat game idea. There are also others, e.g. some Bowling (which didn't work on my old phone, and yet didn't try again) and probably some others.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Android Port

Post by ent1ty »

Please, can someone finally go to COGLESTexture.cpp and change on lines 47, 48, 49

Code: Select all

    if (Driver->FeatureAvailable[COGLES2ExtensionHandler::IRR_IMG_texture_format_BGRA8888] ||
        Driver->FeatureAvailable[COGLES2ExtensionHandler::IRR_EXT_texture_format_BGRA8888] ||
        Driver->FeatureAvailable[COGLES2ExtensionHandler::IRR_APPLE_texture_format_BGRA8888])
to

Code: Select all

    if (Driver->FeatureAvailable[COGLES1ExtensionHandler::IRR_IMG_texture_format_BGRA8888] ||
        Driver->FeatureAvailable[COGLES1ExtensionHandler::IRR_EXT_texture_format_BGRA8888] ||
        Driver->FeatureAvailable[COGLES1ExtensionHandler::IRR_APPLE_texture_format_BGRA8888])
It's really annoying to have to do this every time i get the latest revision...


Also i'm not sure why, but at the end of the build process when it tries to copy libIrrlicht.a to lib/Android I always get this error:

Code: Select all

cp obj/local/armeabi/libIrrlicht.a jni/../../../../lib/Android
process_begin: CreateProcess(NULL, cp obj/local/armeabi/libIrrlicht.a jni/../../../../lib/Android, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [jni/../../../../lib/Android] Error 2
The file itself is OK, i just have to copy it manually
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!
CuteAlien
Admin
Posts: 9721
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android Port

Post by CuteAlien »

lines fixed
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
Post Reply