I need help with that please.
I’ve got several viewports that renders the object selected by the user. If I don’t use a filter, it displays the rendered object, but, as soon as I attach a PostProcessor to the viewport, all the viewport’s settings disapper. It’s moved elsewhere on the screen, background color is reset and there’s nothing in there, ie: the object is either invisible or the entire viewport is empty.
I noticed that in RenderManager → renderViewPort(…) it doesn’t seem to think the SceneProcessor has been initialized.
[java]
if (processors != null) {
for (SceneProcessor proc : processors) {
if (!proc.isInitialized()) { // <
Right here.
proc.initialize(this, vp); // so the viewport is "reinitialized"
}
proc.preFrame(tpf);
}
}
[/java]
I'm probably doing something wrong. Here's how I do it:
[java]
/*
* setViewPort
* @param previewName String, name of the preview
* @param nodeToAttach GameNode that is attached to the viewport
*/
private void setViewPort(String viewportName) {
panelViewPort = gProc.getRenderManager().createMainView(viewportName, panelCam);
panelViewPort.setBackgroundColor(ColorRGBA.DarkGray);
panelViewPort.setClearEnabled(true);
panelViewPort.attachScene(panelNode);
}
/*
* attachNewSceneToViewport
* @param noteToAttach
* new node to attach to viewport
*/
public void attachNewSceneToViewport(GameNode nodeToAttach) {
panelViewPort.clearScenes();
panelViewPort.attachScene(nodeToAttach);
setPostProcess();
}
private void setPostProcess() {
FilterPostProcessor fpp = new FilterPostProcessor(gProc.getAssetManager());
BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects);
fpp.addFilter(bf);
panelViewPort.addProcessor(fpp);
}
[/java]