Login  Register

Re: Simple example with NEWT but without animator

Posted by gouessej on Nov 12, 2013; 9:29am
URL: https://forum.jogamp.org/Simple-example-with-NEWT-but-without-animator-tp4030571p4030593.html

If you really want to do that, rather create a GLRunnable that just calls GLWindow.display() and pass it to GLWindow.invoke(), put that code into your render() method.

You can look at a robust framework supporting JOGL without Animator like Ardor3D:
https://github.com/Renanse/Ardor3D/blob/master/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java#L144
https://github.com/Renanse/Ardor3D/blob/master/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java#L92
https://github.com/Renanse/Ardor3D/blob/master/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java#L201

You have to call JOGL methods on the right thread, when the OpenGL context is current (use invoke()). If you try to reinvent the wheel, you will have the same problems than me when I ported Ardor3D to JOGL 2.x but the difference is that:
- maybe it will be impossible to fix some of them without breaking your code design
- your framework is your problem, your responsibility

Don't use animators if and only if you really know what you're doing.
Julien Gouesse | Personal blog | Website