Use a separate Viewport to draw onto a texture. Then apply that texture to a Nifty Image element.
Nifty nifty = your Nifty instance;
Texture2D tex = the offscreen texture;
Element image = screen.findElementById("ElementId");
ImageRenderer renderer = image.getRenderer(ImageRenderer.class);
renderer.setImage( new NiftyImage(nifty.getRenderEngine(), new RenderImageJme(tex)) );
For this to work, you have to disable Nifty’s texture atlas (Batched Nifty Renderer). You do that by using the right constructor of NiftyJmeDisplay
.
This one for example:
NiftyJmeDisplay(AssetManager, InputManager, AudioRenderer, ViewPort)
You’ll have to find out yourself if it’s really a good idea to do it this way I thought it was too much hassle to use Nifty for the HUD so I’m using simple jME elements.