[SOLVED] IllegalStateException: Framebuffer has erronous attachment. If using FilterPostProcessor or shadows

Hi,

I’ve just updated to jme3.2 because I was having the same Depth24 error in topic Image format 'Depth24' is unsupported but now I’m stucked

Now, If using any post processor filter I’m getting the following exception:

05-15 23:24:40.886 14762 14857 E com.jme3.app.AndroidHarnessFragment: Grave Exception thrown in Thread[GLThread 6865,5,main]
05-15 23:24:40.886 14762 14857 E com.jme3.app.AndroidHarnessFragment: java.lang.IllegalStateException: Framebuffer has erronous attachment.
05-15 23:24:40.886 14762 14857 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.opengl.GLRenderer.checkFrameBufferError(GLRenderer.java:1486)
05-15 23:24:40.886 14762 14857 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.opengl.GLRenderer.updateFrameBuffer(GLRenderer.java:1659)
05-15 23:24:40.886 14762 14857 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.opengl.GLRenderer.setFrameBuffer(GLRenderer.java:1800)
05-15 23:24:40.886 14762 14857 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1082)
05-15 23:24:40.886 14762 14857 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.RenderManager.render(RenderManager.java:1158)

And if removing the filters but keeping shadows:

05-15 23:49:06.246 27063 27085 E com.jme3.app.AndroidHarnessFragment: Grave Exception thrown in Thread[GLThread 7128,5,main]
05-15 23:49:06.246 27063 27085 E com.jme3.app.AndroidHarnessFragment: java.lang.IllegalStateException: Framebuffer has erronous attachment.
05-15 23:49:06.246 27063 27085 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.opengl.GLRenderer.checkFrameBufferError(GLRenderer.java:1486)
05-15 23:49:06.246 27063 27085 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.opengl.GLRenderer.updateFrameBuffer(GLRenderer.java:1659)
05-15 23:49:06.246 27063 27085 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.opengl.GLRenderer.setFrameBuffer(GLRenderer.java:1800)
05-15 23:49:06.246 27063 27085 E com.jme3.app.AndroidHarnessFragment: at com.jme3.shadow.AbstractShadowRenderer.renderShadowMap(AbstractShadowRenderer.java:434)
05-15 23:49:06.246 27063 27085 E com.jme3.app.AndroidHarnessFragment: at com.jme3.shadow.AbstractShadowRenderer.postQueue(AbstractShadowRenderer.java:412)
05-15 23:49:06.246 27063 27085 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1103)
05-15 23:49:06.246 27063 27085 E com.jme3.app.AndroidHarnessFragment: at com.jme3.renderer.RenderManager.render(RenderManager.java:1158)

I’ve read all related topic in the forum:

https://hub.jmonkeyengine.org/t/android-illegalstateexception-after-adding-bloom/38841

But there’s no answer on how to solve it in any of them… Is there any way to make filters and/or shadows properly work on android or is it an engine issue still to be solved?

Thanks

as fas as I am aware, post processing does not work on android at all. And FYI the shadow processor would eat the GPU alive anyway.

As a better alternative, usually a simple “circle/oval shaped” texture below the item works well as a type of shadow, altering the size based on its height.

Hi again,

Thanks @jayfella for your comments but as I’d prefer post processing to work in jme + android, I’ve been having a look at the engine code and there’s an error in the depth16 format definition for openglES2.0 (byte instead of short). I’ve fixed it locally and tested it with shadow rendering working (or at least not arrising the framebuffer exception).

Here’s the patch:

--- GLImageFormats.java 2018-05-17 16:20:15.830191732 +0200
+++ jmonkeyengine/jme3-core/src/main/java/com/jme3/renderer/opengl/GLImageFormats.java  2018-05-17 16:19:47.614425397 +0200
@@ -220,7 +220,7 @@
         
         // NOTE: OpenGL ES 2.0 does not support DEPTH_COMPONENT as internal format -- fallback to 16-bit depth.
         if (caps.contains(Caps.OpenGLES20)) {
-            format(formatToGL, Format.Depth, GL.GL_DEPTH_COMPONENT16, GL.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_BYTE);
+            format(formatToGL, Format.Depth, GL.GL_DEPTH_COMPONENT16, GL.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_SHORT);
         } else {
             format(formatToGL, Format.Depth, GL.GL_DEPTH_COMPONENT, GL.GL_DEPTH_COMPONENT, GL.GL_UNSIGNED_BYTE);
         }

I’m not familiar with git and I’m not sure if I’m allowed to change the code there, it would be nice if any contributor upload it to have it fixed for all users :wink:

I’ll try to test the shadows deeper and also test some other post-processing effects

BR

1 Like

It would be super helpful if you could take that one more step to learn how to submit a pull request. Likely, given the severity, someone would fix this anyway based on your notes but in the long run you and the project would benefit greatly by taking those few minutes to learn that.

Thanks for finding the issue, though. Hopefully one the other core devs will look into it that has more experience with the android side… but your change makes sense to me.

@pspeed I’ve been reading a while about github but I think I’m missing something… I tried to follow the basic hello world (Hello World · GitHub Guides) and, if I understood it correctly, I need to create a branch to make my modifications and then submit the pull request to get it merged into the master, right? But I’m not able to create a branch in the project… Am I missing something?

As soon as I get it clear I’ll do it :wink:

Thanks

I think you need to fork the project first or whatever.

Nice catch.

No luck with it either… I’ve created my fork but I cannot create a pull request from it :confused: Apparently should be done from a branch in the same project

Any help is appreciated

Thanks :wink:

Fork the repository. This means you have your own editable copy. Make the changes and then make a PR with those changes. This will tell the jme version of the changes and ask to commit them.

No need for a new branch etc unless you want to branch off into something new without modifying the master code.

Thank you both @jayfella and @pspeed. I finally managed to create the pull request. I hope it’s accepted and everyone can use filters (although somehow slow) in android :clap::clap::clap:

1 Like

In new version it’s fixed but still getting Framebuffer error.
What I must to do?

This seems not to be fixed in any release yet. Just on the master. Are you using a release or the master? Just to make sure.