Initialization steps...
Posted by ThomasR on Feb 07, 2018; 7:38pm
URL: https://forum.jogamp.org/Initialization-steps-tp4038597.html
Hi,
I'm having trouble establishing a clean Jogamp Ardor3D initialization using AWT or Swing unless there's a visible window on the screen to which I've added a JoglAwtCanvas or JoglSwingCanvas, before FrameHandler.init().
I've played with the order a bit, whether FrameHandler.init() is called before or after the canvas is added to the FrameHandler. But it doesn't matter, the problem is that in the JoglAwtInitializerRunnable JoglAwtCanvas.getDelegatedDrawable() returns null and a NPE is thrown.
I need a generic way to initialize that doesn't depend on the order that components are created, or added to one another. We can't really force applications to do this. Do I have something wrong here? I created a workaround which starts another thread and checks if canvas.getDelegatedDrawable() is null in a loop. When its not null, I do FrameHandler.init() and start the runner thread which does FrameHandler.updateFrame(). It's actually works, but seems very problematic and infrequently fails. Could this be more tightly integrated into the Jogamp Ardor3D framework?
Tom