I have a conflict, in this tutorial is created a new ViewPort to use it in the NiftyJmeDisplay. But I have to use my guiViewPort of jme, because anyway I like to have my HUD?! I think a 2. NiftyJmeDisplay is not possible. Maybe I’m completely wrong. My target is to have the chat, menu … to have in normal 2D. And things like minimap in form of projecting into a texture. How do u handle this?
When it’s not possible I think the best way is projecting the whole interface.
I’m not sure I can understand it completly but.
Im pretty sure you can have multiple niftyjmedisplays, you just have to use different viewports.
Eg one with the guiviewport and one using a custom viewport where the resulting texter is used from.
public class MultipleViewportsTest extends SimpleApplication
public void simpleInitApp()
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(getAssetManager(), getInputManager(), getAudioRenderer(), getGuiViewPort());
ViewPort niftyView = renderManager.createPreView("NiftyView", getCamera());
NiftyJmeDisplay niftyDisplay2 = new NiftyJmeDisplay(getAssetManager(), getInputManager(), getAudioRenderer(), niftyView);
public static void main(String args)
MultipleViewportsTest t = new MultipleViewportsTest();
WARNUNG: An event service by the name NiftyEventBusalready exists. Perhaps multiple threads tried to create a service about the same time?
org.bushe.swing.event.EventServiceExistsException: An event service by the name NiftyEventBusalready exists. Perhaps multiple threads tried to create a service about the same time?
So if I understand correctly, you want to render two different Nifty screens at the same time, one in your gui viewport and another one onto a texture which is applied in the scene somewhere.
This would require two viewports which in turns would require two nifty instances as I don’t believe you can have to nifty screens open at the same time. Nifty will not allow you to create two instances as the event bus uses a constant for a name and creating a second nifty blows up as the eventbus already exists for that name. I could be wrong but last time I tried this that’s what happened.
So the question I suppose is if there is any way of using the same nifty instance and just project a specific screen layer to the other viewport. I don’t know if that’s possible.
One obvious thing is that if the mini map and other things that you want to put in 3D space doesn’t need to be interactable then you can just render the them to a texture outside of Nifty and do it that way instead.
Exactly, the event service already existing name is happening, thats why I wrote I think its not possible to have multiple displays. Yes, maybe its the better way not using nifty when I dont need to interact with it. It seemed to me to be the easier way to use nifty for everything, but ok.