I am trying to create crossplatform 2d game. In desktop version all works fine, but when I run in Andoid, I have this exception. How could I fix it? Any ideas?
I’m getting the same error. Are you using the emulator or a physical device?
Same exception for both device (emulator and physical)
Well, I’m with you in the same boat I’ll post here when Ill find a solution and you too please if you resolve it before
So, It hard to say, but I restart my project in Android Studio, rebuild it and then (only on physical device) it finally worked. But another problem is 10 fps… On emulator same exception
This exception is basically just directly what GL reported - OpenGL ES that is in your case, and this is probably the point and might be either the format or the absence of an attachment. Is this when using shadows, postprocessing or some custom render to texture stuff? I remember ive seen a comment in the source code somewhere that explicitly added a color attachment during the shadow rendering setup (pointless in theory ofc) to prevent some devices from giving that error, if im not wrong
EDIT: like, i mean which one is it: shadows, postprocessing or custom setup? if you use multiple of those, first try to find out which one causes the exception
EDIT: reading the stacktrace again its probably not shadows or postprocessing, somewhere you are creating another viewport with a custom framebuffer and there is something wrong with those attachments
Thanks! you were right! I removed the DirectionalLightShadowFilter and now I’m not getting this crash
Well seems i failed when i read the stacktrace again
Now im wondering what might cause this, and according to the error is has to do with framebuffer completeness which includes size as well as formats and other factors
as from what i can see the Framebuffer has 2 attachments:
1: a depth attachment with Format.Depth (which in GLImageFormats is mapped to GL_DEPTH_COMPONENT16)
2: a color attachment (the fix i mentioned before) with Format.RGBA8 (which in GLImageFormats is mapped to either GL_RGBA8 or GL_RGBA4 depending on wether your hardware supports GL_OES_rgb8_rgba8)
i got a feeling there is something strange with the color format, i guess newer GLES versions support RGBA8 and might not expose the extension string, but before we check that, could you check please if the error also disappears when just using smaller shadow map sizes? like the size you provide in the constructor (i guess there was a check in the code for that somewhere though, so if this was the case it should give another error, but im not sure anymore)
you could also check the GLES version and extensions that your phone supports for further investigation
DLSR, DL, BloomFilter, all do work on OGLES3.2 & OGLES3.0 with framerate 20 ~ 25 & sometimes 35 fps according to other game objects, just to notice it’s a problem with updating shaders & textures inside the framebuffer as stated here by Khronos group, the different features added within OGLES2.0 → OGLES3.0 roadmap is huge…
The only thing that didn’t work on android is the EnvironmentalCamera of the light probes in java code…some folks made it work through Jme SDK…& LightScatteringFilter (i need to test this in different situation to be sure)
Please use OGLES3.0, almost all android devices nowadays use OGLES3.2 which is the latest & some use 3.0,…
BloomFilter, DL, DLSR, PointLights w/ different colors, with PBR Shaders & ParticleEmitters :
Hi @IseTheSal , welcome to jme3 community, can you send us the version of OpenGLES & GLSL for this particular device or emulator ? To be fully sure of the current issue…
As I understood my device (pixel 3a) uses version 3.2, emulator use the same thing.
So I wrore that on physical device I did not have any problems, only on emulator. Fps problem seems wierd for me (10-11 fps), cause in desktop with uhd 630 almost 250 fps.
Anyway, thanks all for explanation!
If you have time, please check the emulator’s OGLES version
Performance when using framebuffers is another thing, its due to tile based renderers and bandwidth, where vulkan with subpasses and load/store ops can come in handy. This however doesnt mean it could not theoretically work on GLES 2.0, setting up a framebuffer with a color and depth attachment to render to i mean, regardless of wether crashing is a well known or documented thing when running on android.
I dont personally develop for android so i dont care per se, i just personally care about the pure knowledge why it doesnt work.
To sum up the occurances of exceptions: @Pavl_G it does happen on your emulator running GLES 2.0, does not happen when running on your phone with GLES 3.2. @IseTheSal does not happen on your phone running GLES 3.2 and seemingly fails on your emulator also running GLES 3.2. Could you please post the log when running on emulator? especially the renderer information printed at the top (i hope it is actually GLES 2.0 and there is something that is not handled according to GLES 2.0 spec, which could be fixed)
I have not tested on emulator GLES2.0, but @adi.barda tested that & reported the exception back, its working fine on emulator GLES3.1 & my device GLES3.2…
@IseTheSal must carefully recheck the emulator GLES version, since its changeable in the advanced settings & usually its auto by default…
@Samwise the crash log reported by Adi :