Batched Nifty GUI - How to redraw an image


at the moment I am trying to batch the gui.
I have a minimap picture which is changing all the time. If I am batching the GUI it does not change.
I am calling setUpdatedNeeded() on my image, but nothing happen.

I already checked that Nifty creates its own texture atlas. I assume this texture atlas does not check this. So how can i change/modify/overwrite this specific part in the texture atlas?

Or is it possible to mark a GUI object as “not-batch” so it is not part of the texture atlas?

An update from my site:

I am calling markBatchRenderImageAsUnloaded() on the NiftyImage.
It works so far, but after a while I have the following error in my log:

Jul 26, 2015 11:11:46 AM de.lessvoid.nifty.batch.BatchRenderImage upload
SEVERE: Image [Landscape_minimap.png] did not fit into the texture atlas and will be missing in your screen

So it seems that is does not replace the image in the texture atlas. This is probably a bug in Nifty? According to the documentation of the methode markBatchRenderImageAsUnloaded():

“This is a special method for the batched renderer. If you use the batched renderer and you have changed the content of the backing texture through some external mechanism (external to Nifty that is, f.i. through jme3) Nifty does not know about your change. In case of the batched renderer this is unfortunate since your modified texture will never be uploaded to the texture atlas in this case. This method allows you to trigger that upload manual by marking this NiftyImage as unloaded Nifty will automatically upload it the next time this NiftyImage is accessed. So you would change the backing texture and then call this method to notify Nifty of your change.”

So probably Nifty uploads a new image every time and do not delete the old one. After a while, the texture altas runs out of space…

Did you tried to generate your image using internal texture atlas and just update the nifty image with that ? I mean, not using the nifty texture atlas ?
Also, I would not use nifty for that, its too slow, it will consume too much fps from your game. I mainly use nifty just for menus or popups, the game UI itself I build it using other methods.

Its always possible that you just have too many images being in use… Does this issue occur if you never call markBatchRenderImageAsUnloaded()?
Would be useful to debug / preview the batch texture atlas just to make sure it looks sane.

Since I am redrawing the image again and again Nifty puts the new image again and again in the texture atlas until it is full. If I do not call markBatchRenderImageAsUnloaded() the image does not get an update. I checked the batch texture and it stores this image multiple times (once for each call of the methode).

So my final solution is a seperated Picture. I just attach it to the guiNode, no Nifty for this. This picute has the texture:

Picture p = new Picture("MiniMap_Picture");
p.setImage(this.desktopAssetManager, MinimapAppState.LandScapeTextureKey, false);

I am just updating the buffer of this image and store it in the assetmanager.