Login  Register

Re: Javafx causes jogl problem in mac

Posted by runiter on Mar 07, 2013; 3:11pm
URL: https://forum.jogamp.org/Javafx-causes-jogl-problem-in-mac-tp4028417p4028539.html

Ok I think I found the source of the problem. In JoglAwtExample it seem to work fine from main() but not works if use threading. So here is a simple test, in JoglAwtExample.main() change the code so that frameWork.updateFrame() is run from a Thread instead of being run directly in main() method:

        new Thread() {
            @Override
            public void run() {
                while (!exit.isExit()) {
                    frameWork.updateFrame();
                    Thread.yield();
                }
                frame.dispose();
                System.exit(0);
            }
        }.start();


Don't forget to change canvas to Newt also:

    private static void addCanvas(final JFrame frame, final ExampleScene scene, final LogicalLayer logicalLayer,
            final FrameHandler frameWork) throws Exception {
        ....
        final JoglNewtAwtCanvas theCanvas = new JoglNewtAwtCanvas(settings, canvasRenderer);
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D