Multiple views of the same scene, each in a separate JPanel/Canvas, using JmeCanvasContext instead o

Title got cut off. That should say “instead of AwtPanelsContext”.

As the title states, is this possible? We can successfully extract a single Canvas from a JmeCanvasContext from a running app and stick it in a JPanel, no problem. And we have, in the past, extracted multiple views of the same scene and placed them in separate AwtPanels, also with no problem. But the performance penalty that is incurred from using AwtPanels seems to be huge in all of our testing; transferring back and forth from the GPU to the CPU crushes the frame rates. In most of our simulations this isn’t a huge deal, but in some of them the difference between JmeCanvasContext and AwtPanelsContext is 100’s or 1000’s of FPS vs 10 FPS.

We tried a few little hacks like spinning up a 2nd JmeCanvasContext using JmeSystem’s factory methods but we got an LWJGL error saying that you can’t have more than one context.

I suppose the real question might be, is there a way to performantly render multiple views of the same scene in disparate JPanels or Canvases?

Only with AWT panels. But what do you want to do, why can’t you use multiple views / pre views?

We would like to have separate windows with different camera views of our virtual world. Separate windows can have different swing controls on them and are generally placed on different monitors (think of first person view on the left monitor and a third person overview on the right monitor).

Look at TestMultiView.

@normen even more specifically, we want the ability to “break out” views. Our simulation suite has, by default, a single window GUI. But on occasion, we like to pop panels out in to their own window. This sort of ties in to what @JesperSmith said, where we would also like the option to have different views on completely different monitors. As far as we can tell from our playing around with split viewports, all of the multi views are tied to one viewport.

If you are working that heavily within swing I’d suggest using the awt panels with multiple views for now and looking for a performance improvement later. I can’t promise anything yet but the JOGL wrapper does work better with swing so you might get a more “native” display view in the same manner when we moved to JOGL.

Generally I’d suggest doing things not with swing but with views and NiftyGUI. You could e.g. have one window that stretches over multiple desktops in a multi-monitor setup. Reason I am saying that is when you do it like this, you can “outsource” some screens even to android or iOS in the future, which sounds like it might make sense given you are working with multiple screens and panels already. Swing generally introduces a lot of issues with threading, compatibility and general performance.