@Override
    public void cleanup() {
        if (viewPort != null) {
            //reset the viewport camera viewport to its initial value
            viewPort.getCamera().resize(originalWidth, originalHeight, true);
            viewPort.getCamera().setViewPort(left, right, bottom, top);
            viewPort.setOutputFrameBuffer(outputBuffer);
            viewPort = null;

            if(renderFrameBuffer != null){
                renderFrameBuffer.dispose();
            }
            if(depthTexture!=null){
               depthTexture.getImage().dispose();
            }
            filterTexture.getImage().dispose();
            if(renderFrameBufferMS != null){
               renderFrameBufferMS.dispose();
            }
            for (Filter filter : filters.getArray()) {
                filter.cleanup(renderer);
            }
        }

    }
compute the index of the last filter to render
jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java