Advantages of using NEWT vs GLCanvas

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Advantages of using NEWT vs GLCanvas

Travis
Hello, I apologize if this has already been answered on this forum.

I'm working with an existing app that's written using jogl's javax.media.opengl.awt.GLCanvas class.  I'm thinking of refactoring everything to use com.jogamp.newt.opengl.GLWindow and com.jogamp.newt.awt.NewtCanvasAWT.  From what I've gathered from the jogl website, NEWT uses a separate threads for rendering and handling input events.  The app I'm using uses a single thread for both, but doesn't currently suffer from performance problems.  So, can anyone tell me if there's a good reason for switching to NEWT?

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Advantages of using NEWT vs GLCanvas

gouessej
Administrator
Hi

NEWT full screen mode works better than its AWT equivalent and the framerate is often a bit higher even though you don't use multiple threads. It has a better support of multiple screens and its handling of the OpenGL context is better for sharing.

Don't use NEWT if you're looking for interoperability with Swing and AWT. NewtCanvasAWT is helpful as another bridge, for example when you use SWT (until the native SWT heavyweight GLCanvas is ready) to put a GLWindow into a SWT composite.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Advantages of using NEWT vs GLCanvas

Sven Gothel
Administrator
On Tuesday, January 31, 2012 05:29:17 PM gouessej [via jogamp] wrote:

>
> Hi
>
> NEWT full screen mode works better than its AWT equivalent and the framerate
> is often a bit higher even though you don't use multiple threads. It has a
> better support of multiple screens and its handling of the OpenGL context is
> better for sharing.
>
> Don't use NEWT if you're looking for interoperability with Swing and AWT.
> NewtCanvasAWT is helpful as another bridge, for example when you use SWT
> (until the native SWT heavyweight GLCanvas is ready) to put a GLWindow into
> a SWT composite.

.. plus we support NEWT across devices (headless, embedded/mobile, ..).
   <http://jausoft.com/blog/2011/10/05/jogljogamp-red-square-moscow-nurbs-graphicon2011>

In a CAD project and I for myself we use NewtCanvasAWT for AWT/Swing integration
and implementing all components [interacting w/ the GLEventListener] AWT/Swing agnostic.
This gives us the advantage of platform freedom and a fast reaction to bugs (AWT, ..)
since we are in charge of them and can fix them - also able to add new features if required.

We already have adaptor/producer classes in place to filter AWT and Android events to NEWT
which then can be handled by NEWT [input] event listener.
This is currently utilized for NewtCanvasAWT, Android and in case you use your NEWT event listener
with AWT components.

http://jogamp.org/jogl/doc/NEWT-Overview.html

Besides the multithreading benefit [rendering independent event dispatcher],
NEWT supports:

 - transparency,

 - fullscreen,

 - decoration less windows,

 - native [re-]parenting

 - Applet integration [easy]
   <http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.html>
   demonstrated here: <http://jogamp.org/deployment/jogamp-current/jogl-test-applets.html>

 - [mouse] pointer control [confine, warp]
   <http://jausoft.com/blog/2011/10/13/new-newt-mouse-features/>

 - .. ?

The JOGL test applets / demos are a nice demonstration of how you just can
deploy a demo as an Applet, desktop application and on mobile (Android)
if implemented solely based on GLEventListener and NEWT listener.

But .. whatever you choose, AWT, SWT, NEWT, ..,
the most important fact here IMHO is *you have a choice*.

Cheers, Sven

PS: NEWT is not in any way related to one of the current US GOP candidates :)

Reply | Threaded
Open this post in threaded view
|

Re: Advantages of using NEWT vs GLCanvas

Travis
Sven,

Thanks for the reply.  For the advantages you listed, namely fullscreen and transparency support, can these be achieved using GLCanvas?

Another thing I was curious about:  Will using NEWT vs AWT have any effect on the stability of jogl? In other words, will NEWT be more stable across a larger range of video cards, or will it make no difference?
Reply | Threaded
Open this post in threaded view
|

Re: Advantages of using NEWT vs GLCanvas

gouessej
Administrator
Hi Travis

As I already said, fullscreen support is broken in AWT on some operating systems. Therefore, as GLCanvas relies on AWT, fullscreen won't work with it everywhere. Transparency support is possible with AWT by using a temporary API in Java 1.6 and with another API in Java 1.7. Look at com.sun.awt.AWTUtilities. However, this helper might not work on some operating systems or with OpenJDK.

http://stackoverflow.com/questions/1416869/how-to-distribute-awtutilities
http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/

NEWT is "only" a native windowing system, it has nothing to do with the support of graphics cards except that GLJPanel uses some OpenGL features that might not be supported on some hardware. NEWT is a complementary feature, not a replacement of the heavyweight existing canvas (AWT GLCanvas and SWT GLCanvas). Best regards.
Julien Gouesse | Personal blog | Website