I wonder if the following can actually be done… and ofcourse, how.
I'm using the JMECanvas to put a scene in my Swing application. Now, as loading the scene takes some time… I'd like to do that prior to actually putting the canvas in my frame. However, I noticed that calling the JMECanvasImplementor's doSetup() method manually (this will otherwise be automatically be called upon, by paint()) leaves my application with an exception_access_violation in Java HotSpot VM. Note that the exception indicates that the problem is actually caused by TextureState.
An unexpected error has been detected by HotSpot Virtual Machine:
Is it not possible to use something like a CardLayout and show something else, then swap to the canvas when it is ready?
That's actually a good idea, however, it would remain an ugly workaround (no offense
Okay, I found a partial solution.
- First I create the renderer and setup all renderstates, passmanagers etc.
- Then I create an empty node as root
- Then I create the canvas using the above as implementor and add it to my Frame
- When it's visible, I call the my own setupScene method which does all the model loading, texturing etc. (all the stuff that really takes a while).
- Meanwhile, I can update loading state in my Swing application so the user knows what is happening.
- When it's done, I simply update the root node's geometric and rendering states, start the canvas repainting thread and I'm there
However, this leaves the user with an ugly empty scene during the loading process