Changing viewports

This should be a simple one but for some reason I can’t figure it out…

I have multiple cameras that I want the player to be able to manage… so I create a deleteCamera() method where the user clicks on a certain view/screen and deletes using the DELETE button.

1 - the way I do it (and correct me if this is wrong) is by setting the viewport of the adjacent camera to the take over the cam to be deleted. The viewport calculates correctly after the deletion however on my window, no updates. Although the adjacent camera has a viewport that should go over the cam to be deleted , that cam is still there.

2- is there a way to remove that camera cz right now I am just setting the other camera’s viewport over it - doesn’t sound right.

thanks in advance guys

edit: I even tried setting the deleted camera’s viewports to (0,0,0,0) and nothing happens. Is there some update() that I need to call???!

have you tried updating to nightly?, i remember someone adding a updategeometricstate() call somewhere recently

but the main question, if I create say 4 cameras like the example here:

can I delete one of them?


Yes, when you remove a view, that portion of the screen basically becomes frozen because jME3 only clears parts of the screen you told it to clear. The way to fix it is to call ViewPort.clearScenes() which ensures there’s nothing to render in that viewport for that frame (thus clearing it), then call RenderManager.remove***ViewPort() on the next frame.