I am currently working on a visualization application which requires multiple views rendered in multiple windows.
I have looked into TestRenderToMemory and I have managed to create the offscreen views. The views seem to be working fine, but I have two main problems:
The performance drops drastically when I open the first offscreen view. For example, if I have ~180-190 fps when looking at some particular part of the scene, the framerate drops to 40-50 after the first offscreen view is opened! The frame rate drops a further 20-30 fps when I open the second view.If I close them, the fps returns to 180-190. My application requires to have up to 4 views opened at once(later, maybe more) and run smoothly on a decent computer (the idea is to put these views on multiple monitors).
Now in TestRenderToMemory there is a mention that some parts of the code are done inefficiently. I am guessing in updateImageContents().
Can you please point me in the right direction on how to improve performance when adding an offscreen view?
Sometimes when I create a new offscreen view, nothing shows up except for a small window with no content in it. However, I am not sure if this only happens on Linux(bug?), or on Windows as well. I will have to test this. Is this a known problem or am I doing something wrong?
It seems to be working. I haven’t really tested out the speed of it yet, but at least I got rid of that bug plus the windows look much better without extra “swing space” around.
However, I have some questions.
First, I want to be able to run a JMonkey application multiple times. What I mean by this is that I have a swing button which starts a simulation. If I close the simulation and start another one, I want a completely separate JMonkey program(with the first one closed). This is what happens after the button is clicked(in a separate class):
I also used simulationApp.stop() to stop the simulation when the window closes, but when I try to open a new one I get an error that start() has already been called. That is why I included a variable called appStarted to check if the application has been previously started and try to restart it. If I do this, the main window opens but no 3d content is displayed(just a normal gray swing window, of the appropiate size). The other windows do not work as well after restarting.
Secondly, I want to have like a main panel(the one the user can actually interact with). For this I have created a global variable for this panel. Everything seems to be working, but when I close this panel, I want to automatically close any other offscreen panels which have been previously opened and destroy the JME instance(so I can start anew).
Oh, and one more thing. The windows are for some reason drawn at the bottom of the screen or even a bit lower, even though they should be drawn of height - 400. Not sure if I messed something up here, though,