Viewport "resets" when adding a FilterPostProcessor (BloomFilter)

hey cool :wink:

(repost in the right thread damn me!)



@nehon we seem to have a little problem… :cry:



When I switch from the galaxy view to another view (Solar system view or Arena view), my preview viewport “disappear”. :frowning:



Let me explain.



Each view is now independent and is implementing AbstractAppState. Every time I switch from one view to another, I delete that viewport, turn that state disabled, etc. But after removeMainview(viewport), that preview on the right is empty, blank, transparent.



I did some tracing and the preview app state is still there, it’s still “rendered” with its post-processing filter and all, but it’s just transparent or whatever. It’s like the removing the mainview of the galaxy scene also removed the preview, but it’s still there. Hard to explain.



Can you make sense of the above? :s



Oh and btw, the previews now look way much better with “setClearFlags(true, true, true)”. Like 10x better. :smiley:

madjack said:
Can you make sense of the above? :s

mhhh barely :p

in fact I think I got it.

Actually I know exactly what's going on!!!

You create both your mainView and the the preview doing renderManager.createMainView(blah).
There are 3 list of viewports in the render manager : preViewoorts, mainViewports, postViewports.
those are just LinkedList or ArrayList (I don't remember). When you create a mainView, a newViewport is added to the mainViewportList.
Viewports are rendered by iterating over this list, in the order they were added.

so...you have in the list mainView/preview

So...when you switch appState and remove the mainView, and then add another viewport you have preview/newMainView.
So your new main view is rendered over your preview that's why you can't see it.

You have 2 solutions :
- remove every main viewport and re-add them in the correct order.
- don't remove the main viewport and just switch the scene it renders.


hope that helps ;)
1 Like
nehon said:
Actually I know exactly what's going on!!!

Excellent! What you're suggesting sounds right to me.


You have 2 solutions :

- remove every main viewport and re-add them in the correct order.



- don't remove the main viewport and just switch the scene it renders.



Solution 1:
hmm... main views are dynamically created. :/ So the ordering will always be switching... I guess I could redo the preview port every time the main view is changed.

Solution 2:
Haha! I just spent several days completely isolating each view (scene) so it would be easier to manage so I don't think I'll go that way. But thanks for the suggestion. ;)


hope that helps ;)

It does. Thanks.