sgothel/jogl — pull request #41 by krisher (2011-11-14 18:15:18+00:00)
Title: More complete implementation of SWT GLCanvas

This is a more or less complete implementation of an SWT based GLCanvas that uses the existing SWTAccessor/NativeWindow support for GL/SWT integration. It is nearly identical (in API and functionality) to the AWT GLCanvas.

The two major differences are:

* Since SWT requires the parent component in the constructor, the SWT GLCanvas is limited to the graphics device that is responsible for the parent Composite (i.e. no graphics device can be specified via the constructor). This actually simplifies some stuff quite a bit (I wrote the getGraphicsConfiguration and related stuff for the AWT GLCanvas a few years ago to work around some X11/Xinerama issues).
* The threading model respects the opengl.1thread system property (via Threading), however the thread dispatching is handled internally (to swt.GLCanvas) when this is set to 'awt' (or 'auto') so that the GL calls are executed in the SWT thread instead of the AWT thread. This could be moved to ThreadingImpl with some reflection to fail gracefully if the SWT library is not present, however it is somewhat more difficult than with AWT because the SWT thread is not statically accessible (and thus may require API changes in Threading).

There are a few items left to tackle with this:

* Unit tests, particularly for the ability to request various GLCapabilities configurations and actually get some reasonable approximation back
* namespace/package, I stuck this in the internal jogamp.opengl.swt package, not sure whether it should really reside in the javax.media... hierarchy (but this is really related to JSR231 stuff), or the com.jogamp hierarchy instead.
* Packaging; I created a new jogl.swt.jar from the build and incorporated this into the jogl.all.jar. There may be some other bundles that this should go into.
* I have only tested this on gtk/linux/x-86_64. The code I wrote should be OK cross platform, however I don't know how extensively the SWTAccessor code that this is based on has been tested, and I only have a cursory familiarity with the NativeWindow implementation code.