Nifty + guiNode question

Hello,
the loading state of my game is composed of 3 screens :

  1. guiNode, something that I want to hide (it contains HUD)
    2)Nifty screen (with a bar and text )
  2. a third screen that should display both text and 3D objects controlled from java, not Nifty gui (such as a rotating hourglass).

I created a post view port for nifty, so they automatically hide the HUD, and I want to create another post view port for the third screen but I get “IllegalStateException” when attachig the scene to this new viewport. Am I doing something conceptually wrong? Is there a better way to do the loading state described above?

What is the full exception? Are you attaching the scene from the render thread?

Full exception says

But I’m attaching a spatial in the “initialize” code of my app state. This is what I do

@Override
public void initialize(AppStateManager stateManager, Application app) {
	super.initialize(stateManager,app);
	this.app = (SimpleApplication) app;
	/* other stuff */
	<strong>this.afterNiftyVP = app.getRenderManager().createPostView("After Nifty View Port", app.getCamera());</strong>
	this.initText();
}
and in initText :
loadingText = new BitmapText(customFont,false); loadingText.setText("Loading "); loadingText.setSize(customFont.getCharSet().getRenderedSize()); loadingText.setName("Loading Text"); afterNiftyVP.attachScene(loadingText);

It’s the first time that I create post view, so maybe I miss something. The initialize should be called by JME3 Render thread so I should be able to modify scene from there.

If you are creating your own viewports then you will need to manage the updating of anything you put in it yourself. Once per frame you will have to call updateLogicalState and updateGeometricState on whatever root node you put there.

1 Like

Thank you!