Android black GUIs

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android black GUIs

Post by CuteAlien »

OK, new version has 2 changes to help hunting the bug. But again need your help.

I added error checks in COpenGLCoreTexture constructors. Currently the most suspcious place to me. Please check again which is the first place you get the error now. If it's line 135 or 181 then we got it already in texture creation. In that case please modify COpenGLCoreTexture.h some more by adding more calls to Driver->testGLError(__LINE__) in the corresponding constructor at earlier places. My guess currently is that one of the calls in there triggers it. So basically try to find the line after which it goes wrong. Then we can check OpenGL documentation to figure out in which cases that call can go wrong.

The other thing I changed is that log-messages got cut before (now long logs are split so we can see the full text). And there is some useful information which I'd like you to post - the supported extensions on your device. Also won't hurt to add the driver infos. They are printed on start and on my device they look for example like that:

I/Irrlicht(25303): EGL version: 1.400000
I/Irrlicht(25303): EGL context created with OpenGLESVersion: : 2
I/Irrlicht(25303): Using renderer: OpenGL ES 3.0 V@84.0 AU@04.04.02.162.107 (CL@)
I/Irrlicht(25303): Qualcomm
I/Irrlicht(25303): GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_sync GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_
I/Irrlicht(25303): texture_sRGB_decode GL_EXT_texture_filter_anisotropic GL_EXT_multisampled_render_to_texture GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query
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
luthyr
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm

Re: Android black GUIs

Post by luthyr »

You might be running into an issue I was also having. I took out a block of code in order to fix the issue, in COGLES2Texture.cpp:

Code: Select all

    if (!level && newTexture && regMipmap)
    {
        if (IsCompressed && !mipmapData)
        {
            if (image->hasMipMaps())
                mipmapData = static_cast<u8*>(image->lock())+compressedImageSize;
            else
                HasMipMaps = false;
        }
 
        regenerateMipMapLevels(mipmapData);
 
      // NOTE: Took this out as it seems to cause black textures for fonts and other UI.
      //if (HasMipMaps) // might have changed in regenerateMipMapLevels
      //{
      //   // enable bilinear mipmap filter
      //   GLint filteringMipMaps = GL_LINEAR_MIPMAP_NEAREST;
      //
      //   if (filtering == GL_LINEAR)
      //      StatesCache.BilinearFilter = true;
      //   else
      //   {
      //      StatesCache.BilinearFilter = false;
      //      filteringMipMaps = GL_NEAREST_MIPMAP_NEAREST;
      //   }
      //
      //   StatesCache.TrilinearFilter = false;
      //   StatesCache.MipMapStatus = false;
      //
      //   glTexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, filteringMipMaps);
      //   glTexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, filtering);
      //}
    }
 
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Android black GUIs

Post by LunaRebirth »

CuteAlien wrote:OK, new version has 2 changes to help hunting the bug. But again need your help.

I added error checks in COpenGLCoreTexture constructors. Currently the most suspcious place to me. Please check again which is the first place you get the error now. If it's line 135 or 181 then we got it already in texture creation. In that case please modify COpenGLCoreTexture.h some more by adding more calls to Driver->testGLError(__LINE__) in the corresponding constructor at earlier places. My guess currently is that one of the calls in there triggers it. So basically try to find the line after which it goes wrong. Then we can check OpenGL documentation to figure out in which cases that call can go wrong.

The other thing I changed is that log-messages got cut before (now long logs are split so we can see the full text). And there is some useful information which I'd like you to post - the supported extensions on your device. Also won't hurt to add the driver infos. They are printed on start and on my device they look for example like that:

I/Irrlicht(25303): EGL version: 1.400000
I/Irrlicht(25303): EGL context created with OpenGLESVersion: : 2
I/Irrlicht(25303): Using renderer: OpenGL ES 3.0 V@84.0 AU@04.04.02.162.107 (CL@)
I/Irrlicht(25303): Qualcomm
I/Irrlicht(25303): GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_sync GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_
I/Irrlicht(25303): texture_sRGB_decode GL_EXT_texture_filter_anisotropic GL_EXT_multisampled_render_to_texture GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query

Code: Select all

I/Irrlicht(15349): EGL version: 1.400000
I/Irrlicht(15349): EGL context created with OpenGLESVersion: : 2
I/Irrlicht(15349): Using renderer: OpenGL ES 2.0
I/Irrlicht(15349): Imagination Technologies
I/Irrlicht(15349): GL_EXT_debug_marker GL_OES_EGL_image GL_OES_EGL_image_external 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_IMG_texture_compression_pvrtc2 GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_EXT_texture_compression_s3tc
luthyr wrote:You might be running into an issue I was also having. I took out a block of code in order to fix the issue, in COGLES2Texture.cpp:

Code: Select all

    if (!level && newTexture && regMipmap)
    {
        if (IsCompressed && !mipmapData)
        {
            if (image->hasMipMaps())
                mipmapData = static_cast<u8*>(image->lock())+compressedImageSize;
            else
                HasMipMaps = false;
        }
 
        regenerateMipMapLevels(mipmapData);
 
      // NOTE: Took this out as it seems to cause black textures for fonts and other UI.
      //if (HasMipMaps) // might have changed in regenerateMipMapLevels
      //{
      //   // enable bilinear mipmap filter
      //   GLint filteringMipMaps = GL_LINEAR_MIPMAP_NEAREST;
      //
      //   if (filtering == GL_LINEAR)
      //      StatesCache.BilinearFilter = true;
      //   else
      //   {
      //      StatesCache.BilinearFilter = false;
      //      filteringMipMaps = GL_NEAREST_MIPMAP_NEAREST;
      //   }
      //
      //   StatesCache.TrilinearFilter = false;
      //   StatesCache.MipMapStatus = false;
      //
      //   glTexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, filteringMipMaps);
      //   glTexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, filtering);
      //}
    }
 
Unfortunately I cannot find the file COGLES2Texture.cpp.
I found the declaration of COGLES2Texture in COGLES2Common, but no code similar to that you posted.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android black GUIs

Post by CuteAlien »

@ LunaRebirth: Thanks. Can you also tell where the first error-line is now?
And yeah - COGLES2Texture got replaced and mipmap code has changed.
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
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Android black GUIs

Post by LunaRebirth »

It's still printing 1098 on ogl-es 5510
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android black GUIs

Post by CuteAlien »

Hm, unexpected. I have to debug the hello-world a little bit to see which opengl functions might be called after setup and before draw2DImage (and not having already another error-check).
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
Arclamp
Posts: 71
Joined: Thu Oct 10, 2013 7:45 pm

Re: Android black GUIs

Post by Arclamp »

Just to add to the mix...

I was setting up a new laptop the other day and the new SDK etc now used Clang, also was set up to use C++11

I even got some library alignment issues (but that was later in MY chain, but did reference irr lib), in the end I just went back to old SDK / NDK rather than sort everything

Doubt its the issue here, but...
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android black GUIs

Post by CuteAlien »

Hm, all kind of stuff called earlier, but not sure if adding checks all over the place in the engine is a good idea (don't know right now about the costs of that check - probably could be ignored... but some of those functions are called a lot).

You could try getting closer by disabling stuff. Like remove drawAll from SceneManager and check if it's still giving you errors. Or remove drawAll from GuiEnviornment and check for same. edit: I guess you already did - realizing now that when you got the black without the error it was probably just using GuiEnvironment or so.

I don't really know how to get closer to this right now as I can't reproduce it here. So I can only ask you to add locally in your version "testGLError(__LINE__);" all over the place in the COGLES2Driver until you find one that is triggered earlier. And then move it around until you got the exact opengl call which fails.

Also Arclamp certainly has a good idea. Which NDK version are you working with right now?

I will also try testing here on another Android device (edit: Sorry, also not getting bugs on that one. I need more test-devices...).
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
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Android black GUIs

Post by LunaRebirth »

Arclamp wrote:Just to add to the mix...

I was setting up a new laptop the other day and the new SDK etc now used Clang, also was set up to use C++11

I even got some library alignment issues (but that was later in MY chain, but did reference irr lib), in the end I just went back to old SDK / NDK rather than sort everything

Doubt its the issue here, but...
Which version did you backdate to?

My SDK / NDK hasn't been updated in quite a while, so I'm currently downloading the most recent versions. I'm sure it probably won't help me, but figured it was worth a shot.


Another issue I'm having (before SDK update) is that switching from landscape to portrait (or vice-versa) is crashing the Android application -- even in the hello world example.

EDIT:
Uninstalling Android Studio and removing the SDK, then redownloading everything needed in the Hello World Android tutorial readme.txt with the most recent versions (except ant which I got from http://android-sdk.en.lo4d.com/download/mirror-ex1), no fixes. Which was expected.. would have been surprised if it worked.
I'm using Android 10 like the tutorial, does that make a difference?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android black GUIs

Post by CuteAlien »

For crash you can try removing the android::setSoftInputVisibility calls. The Android soft keyboard doesn't work in landscape mode with newer Android versions in NDK, they broke it around 4.x and I never found another way get it working (have to write a keyboard gui-element in Irrlicht one day probably).

You should get a callstack on crashes - maybe that also gives a hint in case it's not the keyboard.
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
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Android black GUIs

Post by LunaRebirth »

CuteAlien wrote:For crash you can try removing the android::setSoftInputVisibility calls.
Fixed the crash, but now the app just closes without error instead.


Seems GL_INVALID_OPERATION is coming from

Code: Select all

MaterialRenderer2DActive->OnSetMaterial(Material, LastMaterial, true, 0);
in COGLES2Driver::setRenderStates2DMode
Arclamp
Posts: 71
Joined: Thu Oct 10, 2013 7:45 pm

Re: Android black GUIs

Post by Arclamp »

The NDK I'm using is: android-ndk-r15b-linux-x86_64

If closing without error then you're going to have to litter with debug comments, very annoying... But first check how its exiting the render loop?

TBH I've not even gone out of portrait mode recently, and before I fixed in landscape mode. I'll try to do some tests on that soon, I do have code to detect widow size change in my render loop for the desktop versions, is that the same method you use on Android or do you capture an event or something?
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Android black GUIs

Post by LunaRebirth »

Arclamp wrote:The NDK I'm using is: android-ndk-r15b-linux-x86_64

If closing without error then you're going to have to litter with debug comments, very annoying... But first check how its exiting the render loop?

TBH I've not even gone out of portrait mode recently, and before I fixed in landscape mode. I'll try to do some tests on that soon, I do have code to detect widow size change in my render loop for the desktop versions, is that the same method you use on Android or do you capture an event or something?
Okay, I'm on windows. In Android Studio, it says I'm using ndk version 15.1.4119039.
I'm detecting window size change on Windows, but not android.

Seeing as the issue could potentially be that the shaders aren't linking properly, I see I'm receiving this error:

Code: Select all

I/Irrlicht(19430): Warning: Missing shader files needed to simulate fixed function materials:
I/Irrlicht(19430): media/Shaders/COGLES2Renderer2D_noTex.fsh
I/Irrlicht(19430): Shaderpath can be changed in SIrrCreationParamters::OGLES2ShaderPath
I/Irrlicht(19430): GLSL shader program failed to link
I/Irrlicht(19430): GL_INVALID_OPERATION: 423
I/Irrlicht(19430): Android command APP_CMD_GAINED_FOCUS
I/Irrlicht(19430): Window size:(1380/720)
I/Irrlicht(19430): Display size:(1380/720)
I/Irrlicht(19430): getScreenSize:(1380/720)
In my jni/Android.mk file, I have

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/)
In my project, I am doing

Code: Select all

for ( u32 i=0; i < Game::device->getFileSystem()->getFileArchiveCount(); ++i )
{
     IFileArchive* archive = Game::device->getFileSystem()->getFileArchive(i);
     if ( archive->getType() == EFAT_ANDROID_ASSET )
     {
          archive->addDirectoryToFileList("media/");
          break;
     }
}
I've verified that media/Shaders/ has the shaders (it does), and that they are copying over to assets/media/Shaders/ (they are).
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android black GUIs

Post by CuteAlien »

OK, missing shader definitely explains black output (it can't draw anything without shaders in OGL ES2). And if it only complains about that specific shader missing and not the others... that's the newest one, the others had been around for longer. So my guess is that you don't have that specific file for some reason. But it's checked-in to the Irrlicht media folder, so get it from there.
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
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Android black GUIs

Post by LunaRebirth »

Yes that seems to be the issue.
I added that specific file, and now I am seeing the others

Code: Select all

I/Irrlicht(11769): Could not open vertex shader program file: assets/media/Shaders/COGLES2Solid.vsh
I/Irrlicht(11769): Could not open pixel shader program file: assets/media/Shaders/COGLES2Solid.fsh
I/Irrlicht(11769): GLSL shader program failed to link
I/Irrlicht(11769): Could not open vertex shader program file: assets/media/Shaders/COGLES2Solid2.vsh
I/Irrlicht(11769): Could not open pixel shader program file: assets/media/Shaders/COGLES2Solid2Layer.fsh
I/Irrlicht(11769): GLSL shader program failed to link
I/Irrlicht(11769): Could not open vertex shader program file: assets/media/Shaders/COGLES2Solid2.vsh
I/Irrlicht(11769): Could not open pixel shader program file: assets/media/Shaders/COGLES2LightmapModulate.fsh
I/Irrlicht(11769): GLSL shader program failed to link
I/Irrlicht(11769): Could not open vertex shader program file: assets/media/Shaders/COGLES2Solid2.vsh
I/Irrlicht(11769): Could not open pixel shader program file: assets/media/Shaders/COGLES2LightmapAdd.fsh
I/Irrlicht(11769): GLSL shader program failed to link
All of those it couldn't open are in the assets/media/Shaders/ folder.

EDIT:
seems irrlicht checks assets/media/Shaders and assets/assets/media/Shaders.
I just duplicated the files and it fixed.
Post Reply