Nifty problem while using multiple viewports


I have this in my nifty xml:

[xml]<layer id="layer3" childLayout="horizontal">

<text id="stateText" font="aurulent-sans-36-bold-with-shadow.fnt" color="#ffff" text="test"

align="left" valign="bottom" />


NiftyJmeDisplay is attached to guiViewPort.

I also create secondary viewport like this:

[java]playerViewPort = renderManager.createMainView("Player port", playerCam);


playerViewPort.setClearFlags(false, false, false);[/java]

When I create the viewport then the nifty stateText is not visible.

But when I disable the newly created viewport then the nifty stateText is visible.

Any ideas?

Not enough information?

Break it down into a test case we can run and you will be more likely to get help faster. You can also try having your second viewport render the gui instead.

Test cases, test cases, test cases… I’ll try to remember that :slight_smile:

BTW what is the difference between main viewport and post viewport? Is it the just order of processing?

Because nifty is rendered in a post viewport so it should be always on top of all main viewports right?

Can it be related to this?

Hard to tell, the code you posted doesn’t show how it is set up and updated.

There are pre, main, and post viewports. That is the order they are rendered. So you want your gui viewport to be a post viewport. If you have several main viewports and they are rendered on top of each other, then I believe the 2nd one will render over the first. But that doesn’t mean they completely overwrite what is under them. That is what the setClearFlags() is for.

I found out thet when I turn the camera in the secondary viewPort the bitmap text becomes visible so it’s probably related