Random crashes with com.jme3.post.Filter

Hi all,

I’m fighting a crash for a couple of days now and I can’t find it.
I really beg your help as I don’t see how to find its cause(s).

This is the only output I get from the crash :

=== OpenGL FBO State ===
May 27, 2015 9:58:21 PM com.jme3.renderer.lwjgl.LwjglRenderer setFrameBuffer
Context doublebuffered? false
FBO ID: 70
Is proper? true
Is bound to draw? true
SEVERE: === jMonkeyEngine FBO State ===
Is bound to read? true
FrameBuffer[format=1280x960x1, drawBuf=0]
Depth => BufferTarget[format=Depth]
== Renderbuffer Depth ==
Color(0) => TextureTarget[format=RGBA8]
RB ID: 263

Is proper? true
Type: Buffer
RB ID: 263
== Renderbuffer Color0 ==
RB ID: -1
Is proper? false
Type: Texture
May 27, 2015 9:58:21 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalStateException: Framebuffer has erronous attachment.
    at com.jme3.renderer.lwjgl.LwjglRenderer.checkFrameBufferError(LwjglRenderer.java:1327)
    at com.jme3.renderer.lwjgl.LwjglRenderer.setFrameBuffer(LwjglRenderer.java:1606)
    at com.jme3.post.FilterPostProcessor.renderProcessing(FilterPostProcessor.java:200)
    at com.jme3.post.FilterPostProcessor.renderFilterChain(FilterPostProcessor.java:281)
    at com.jme3.post.FilterPostProcessor.postFrame(FilterPostProcessor.java:294)
    at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:987)
    at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
    at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
    at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
    at java.lang.Thread.run(Thread.java:745)

It happens after a couple of minutes (2 to 5) of “stress testing” my game. (“stress testing” means I do my best to make my game do the most it can make in a minimum amount of time)
The crash only happens when I use that stupid overlay shader I wrote :

uniform sampler2D m_Texture;
varying vec2 texCoord;
uniform sampler2D m_OverlayTexture;
uniform float m_Alpha;
uniform float m_AspectRatio;

void main() {
    vec4 texOverlay = texture2D(

    gl_FragColor =  (m_Alpha*texOverlay.a*texOverlay) 

It is used by a class extending com.jme3.post.Filter. I can add/remove up to 10 instances of this class to my “main” FilterPostProcessor.
What I wanted to achieve is to add multiple overlays with different alpha values.

It’s achieving exactly that and it’s beautiful to look for a couple of minutes. Then it crashes.
It’s happening “randomly” (= not linked to any particular part of the code I use in the update loop) and only after 2-5 minutes of “stress testing”.

Please help the clueless man I am. How/Where may I find more information about this crash ?

Like you are adding and removing them every frame? Why are there 10 of them that essentially do the same thing?

I think perhaps the keyhole view we have of your code is not enough.

I’m just painting “dirt” on camera like water drops, mud, …
Each filter is painting a specific overlay of dirt at different alpha values so this is why I have up to 10 of them.
I’m not adding/removing them on each frame but on certain events. (so there is a probability of “duplicating” a filter even if they are different instances. is that a problem ?)
I know there is many different ways to do that but this one was really easy and fast to implement :smile:

So it’s just like putting some textured quads on the screen?

It’s probably cheaper/simpler/better just to put some textured quads on the screen.

Sorry for not providing any code. It’s not that I don’t want to provide it but as the crash happens randomly I don’t know what to post.
Yes textured quads will do the trick. I had a couple of ideas related to water diffraction that I wanted to test quickly and it was so easy to add it to my existing code. I’ll go the textured quads way as I’ve already spent too much time on that crash.

But what is wrong with my current technique anyway ? Please tell me because I feel like a kid prevented from using a toy for no reason he can understand. I also fear this unsolved bug might come back as I’m using filters for other (more appropriate) things too.
Is the filter list supposed not to be touched in the update loop or something like that ?

I couldn’t get no sleep tonight so I tested on a lower end configuration (company laptop). I couldn’t reproduce it … but as this computer is slower maybe the stress test was not stressful enough.

What would you do to debug that if you were in my shoes ?

Well, personally, I don’t trust the fpp to let me add/remove lots of stuff so I generally add my filters once and then enable/disable them.

So maybe there is a bug. Maybe you are exploiting some issue with your graphics driver… who knows.

Regardless, you are really taxing the whole system to do something relatively simple.

Thank you Paul :smile:
Yeah I’ll go the quad way, force my brain to forget this bad experience with fpp, and move on.

PS: best wishes for Mythruna