From ad27f9e288de02941a856d4c27bf1de0a536a50c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 17 Sep 2011 15:00:46 +0200 Subject: Make jogl-test-applets look nice; Add NEWT Overview; Link both to JOGL's index page --- doc/NEWT-Overview.html | 181 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 doc/NEWT-Overview.html (limited to 'doc/NEWT-Overview.html') diff --git a/doc/NEWT-Overview.html b/doc/NEWT-Overview.html new file mode 100644 index 000000000..430a81c0b --- /dev/null +++ b/doc/NEWT-Overview.html @@ -0,0 +1,181 @@ + + + + + + NEWT - JOGL’s High Performance Native Windowing Toolkit + + +
+ + +
+
+

NEWT - JOGL’s High Performance Native Windowing Toolkit

+ +

NEWT Usage

+ +

+Consider the classic demo code + GearsES2.java + [v2.0-rc3], +which implements a +GLEventEventListener.

+ +

+The simple application +TestGearsES2NEWT.java + [v2.0-rc3] +creates a NEWT +GLWindow, +which implements a +GLAutoDrawable +and hence is able to add the demo code. +NEWT’s GLWindow also implements the NEWT Window, +which gives you full control of the native windowing, as shown in the demo.

+ +

+Finally we just add our GLWindow to an +Animator instance, +which renders our demo in it's own rendering thread independent from user input.

+ +

+For NEWT’s AWT integration, please read the dedicated section below. +

+ +

NEWT Threading Overview

+ +

NEWT’s event model is pretty simple.
+It spawns one Event Dispatch Thread (EDT) for each unique Display which role is to handle:

+
    +
  • input events
  • +
  • window lifecycle actions (window visibility, resize, .. etc)
  • +
  • not rendering
  • +
+ +

+High performance rendering is achieved without being blocked by input events or vice versa.
+As demonstrated in the above NEWT example, rendering does not disturb or lag user input.
+This gives you fluent animation even for complex models.

+ +

NEWT’s AWT integration and NEWT Applet’s

+ +

+NewtCanvasAWT, +representing an AWT Canvas, allows you to hook a NEWT Window into it.

+Since the NewtCanvasAWT is an AWT heavyweight Component, this gives you the ability hook NEWT into an AWT UI.
+

+The implementation uses the AWT native JAWT API to reparent the NEWT Window natively into the AWT one
+and hence is even more compatible with JOGL’s GLCanvas implementation.

+

+This enables us to use both worlds, AWT/Swing UI and decoupled high performance rendering.

+ +

+TestParenting01cAWT.java +[v2.0-rc3] +shows you how to add an GLWindow to an NewtCanvasAWT, which iself is added to an AWT Frame.
+It also shows how the NewtCanvasAWT can be easily removed from the AWT Frame and placed into another AWT Container.
+Since we use native reparenting, the native window resource keeps alive and hence your OpenGL application (GLEventListener) +is not being asked to dispose all resources.
+TestParenting01cSwingAWT.java +[v2.0-rc3] +shows the same example using Swing.
+

+ +

+Last but not least, the above mechanism can be used to show NEWT Window’s in an AWT Applet.
+JOGLNewtApplet1Run +is an Applet launcher for any +GLEventEventListener +exposing a default constructor. +See it alive here. +

+ + + + +

How to pass user input back to the rendering loop ?

+ +The following example shows you how to use a fifo to pipe events from the EDT (listener) to the rendering loop. + +

How to inject some GL action to the rendering loop ?
+ Shows you how to inject GL render actions into a GL fifo from another thread.

+ + +

AWT agnostic input event listener
+We also have a way to write AWT agnostic input event listener:

+ + +

We provide some utilities to make life a bit easier.
+These are not really necessary, ie you could write and use your own, sure.

+

The NEWT threading requirements are easy – they are just none for rendering,
+ +and the input event listener should better not lock the rendering GL context.
+Well, they can using GLContext.setSynchronized(true) etc .. ,
+but that would be a pity performance wise.

+ +

References

+ +
+
+ +
+ + -- cgit v1.2.3