Dear everybody,
I’ve got a (probably really simple) question concerning viewports:
I’ve got a viewport, which is separate from the one that is shown on screen.
I’ve got my scene. What I do is:
Node scene;
Node copyOfScene = scene.clone();
//Doingsomeweirdstufftocopy commences.
//create camera
//create viewport
Viewport portyMcPortface = renderManager.createMainView(blabla);
// attach the scene, enableviewport, setoutputframebuffer
portyMcPortface.attach(copyOfScene);
Then I can see what I want to see using this viewport. So far, so good.
I need to update things while the game is running, because I want to make changes to copyOfScene.
So I have an update medthod like this:
Node anothercopy = copyOfScene.clone();
//do stuff to another copy
//attach to the Viewport
portyMcPortface.attach(anothercopy);
This I call from update.
What happens is that I get exactly what I want, (the scene with my changes made), BUT:
Several frames of the scene are rendered to the same image, meaning that several frames are “layed on top of each other”.
I am fairly certain that not detaching the scene is the problem, because the sceneList in the viewport just grows larger every update.
I tried to detach the “old” scene from the viewport, I tried to clean the viewport.
This works (no overlayed frames), BUT some of the stuff that I’ve done to the scene (to the non moving parts of the scene) is gone.(I am painting parts of the scenery in a certain way)
Can anyone point me into the right direction here? (Without giving me code, just a high level explanation where my understanding is wrong.)