@Override
    public void beginFrame() {
        log.fine("beginFrame()");

        for (int i = 0; i < batches.size(); i++) {
            batchPool.free(batches.get(i));
        }
        batches.clear();

        // in case we have pending modifyTexture calls we'll need to execute them now
        if (!modifyTextureCalls.isEmpty()) {
            Renderer renderer = display.getRenderer();
            for (int i = 0; i < modifyTextureCalls.size(); i++) {
                modifyTextureCalls.get(i).execute(renderer);
            }
            modifyTextureCalls.clear();
        }
    }
Nifty GUI BatchRenderBackend Implementation for jMonkeyEngine.

@author void
jme3-niftygui/src/main/java/com/jme3/niftygui/JmeBatchRenderBackend.java