Hi,
After having solved the framebuffer issue in android, I’ve been testing multiple features and found the following.
Shadows are not working giving the following exception:
E/com.jme3.app.AndroidHarnessFragment(22594): com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Shadow/PostShadow.frag, defines, type=Fragment, language=GLSL100]
E/com.jme3.app.AndroidHarnessFragment(22594): Fragment shader compilation failed.
E/com.jme3.app.AndroidHarnessFragment(22594): WARNING: 0:10: extension 'GL_ARB_gpu_shader5' is not supported
E/com.jme3.app.AndroidHarnessFragment(22594): ERROR: 0:116: 'sampler2DShadow' : Reserved word.
E/com.jme3.app.AndroidHarnessFragment(22594): ERROR: 0:116: 'sampler2DShadow' : Syntax error: syntax error
E/com.jme3.app.AndroidHarnessFragment(22594): ERROR: 2 compilation errors. No code generated.
Reading the Shadows.glsllib file, it seems that it detects HARDWARE_SHADOWS to be declared but sampler2DShadow (and maybe all other shadow related types and/or functions) are not defined. Also according to this page OpenGL ES, Android and iOS TODOs · castle-engine/castle-engine Wiki · GitHub there’re not supposed to be defined on openglES20. I’ve not found any other reference
So, I modified Shadows.glsllib file with the following patch to try to solve it:
--- Shadows.glsllib 2018-05-18 15:23:17.339274200 +0200
+++ ./jme3-core/src/main/resources/Common/ShaderLib/Shadows.glsllib 2018-05-18 15:23:37.390448000 +0200
@@ -28,7 +28,10 @@
#endif
#else
#define IVEC2 vec2
- #ifdef HARDWARE_SHADOWS
+ #if defined GL_ES
+ #define SHADOWMAP sampler2D
+ #define SHADOWCOMPARE(tex,coord) step(coord.z, texture2DProj(tex, coord).r)
+ #elif defined HARDWARE_SHADOWS
#define SHADOWMAP sampler2DShadow
#define SHADOWCOMPARE(tex,coord) shadow2DProj(tex, coord).r
#else
Depending on the mobile phone (SGS6), now it’s arrising a different shader compilation error:
05-18 13:59:58.620 31543 31561 E com.jme3.app.AndroidHarnessFragment: Grave Exception thrown in Thread[GLThread 11576,5,main]
05-18 13:59:58.620 31543 31561 E com.jme3.app.AndroidHarnessFragment: com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Shadow/PostShadow.frag, defines, type=Fragment, language=GLSL100]
05-18 13:59:58.620 31543 31561 E com.jme3.app.AndroidHarnessFragment: 0:10: P0001: Extension directive must occur before any non-preprocessor tokens
In my xiaomi redmi3s it works.
This can be easily solved just by removing the line “#extension GL_ARB_gpu_shader5 : enable” . I don’t know which problems could generate this change but for android it’s ok and also, this line of code was not executed because it’s set to work at GLSL 100
About shadows, I have other weird issue, depending on the phone, some filters work or not, in SGS6 after removing the extension line, all work but in redmi3 just nearest and bilinear show the shadows properly.
Most of the filters I’ve tried (for example those needing multisampling) by now are failing in SGS6 with the same error (P0001: Extension directive must occur before any non-preprocessor tokens)
I think that some shaders would need a re-writing to be fully compatible with android but I’m not that good at it