Render guiNode BEFORE niftygui

Hi Monkeys,



the topic says it all: I have some spatials that sit in the guiNode and a nifty GUI. Now I want to force the guiNode to be rendered before the nifty gui gets rendered. The image illustrates it:







The white city billboards are in the guiNode because they have to move with the camera to sit correctly in front of the city. The problem is that at the bottom those billboards shine trough the nifty gui.



Cheers

Just remove the guinode from guiviewport, add the niftyjmedisplay to it, and finally re-add the guinode to it. Btw I wonder why are you mixing two gui systems.

Erm,



firstly: thx of course. Is this what you suggest?



guiViewPort.detachScene(guiNode);

guiViewPort.addProcessor(niftyDisplay);

guiViewPort.attachScene(guiNode);



This (naturally) doesn’t change anything. I don’t quite get what you meant. Could you be more specific? I first want to render the guiNode and only then start to render the nifty gui.



Concerning your question: Nifty is great but only (IMO) if you know beforehand where everything has to sit. But because these billboards can move in every frame to some other place it is far more convenient to use Spatials than to use controls and change attributes inside nifty elements etc.

mhh… maybe you could try to make 2 Gui ViewPort the first for your custom ui, the second for NIfty

Hmm. I thought that would work. Then try what nehon suggested.

Yeah it works just do that

[java]

Camera guiCam = guiViewPort.getCamera().clone();

ViewPort niftyViewPort = renderManager.createPostView("Nigty Gui", guiCam);

niftyViewPort.setClearFlags(false, false, false);

niftyViewPort.addProcessor(niftyDisplay);

[/java]

2 Likes

Hey,



yes nehon. That worked like a charm :slight_smile: Thank you!



In case everyone wants to see the code:



[java]// Attach the gui that needs to be drawn first

guiViewPort.attachScene(guiNode);

guiNode.setQueueBucket(Bucket.Gui);



// And THEN the gui that needs to be drawn above it

Camera guiCam = new Camera(settings.getWidth(), settings.getHeight());

ViewPort guiViewPort2 = renderManager.createPostView("Gui 2 Default", guiCam);

guiViewPort2.addProcessor(niftyDisplay);

guiViewPort2.setClearFlags(false, false, false);

[/java]

1 Like

LOL, looks like we posted at the same time :smiley: I took the code from Application.class :slight_smile:

@Dodikles said:
I took the code from Application.class :)

heheh so did I ;)

Well twice is better than none ;)

I searched in Application.java too, but didn’t find anything xD.