TestBug694 -> TestBug694AWT so it properly gets picked up by the AWT unit test ant task.
GLJPanel: Add DEBUG_VIEWPORT flag, Add USE_GLSL_TEXTURE_RASTERIZER flag, DEBUG reshape trace.

- Add DEBUG_VIEWPORT flag
  Via explicit property 'jogl.debug.GLJPanel.Viewport' (not via jogl.debug=all)
  Traces the current GL Viewport in OffscreenBackend.postGL(..)

- Add USE_GLSL_TEXTURE_RASTERIZER flag
  Via explicit property 'jogl.gljpanel.noglsl'.
  Disables use of GLSL FBO flipping.

DEBUG reshape trace
GLJPanel: Updating GLJPanel documention w/ current mode of operation
Fix buggy unit test for Bug 694: The unpack alignment has to be considered!
Fix Mix2TexturesES2 unit tests: Use synchronized texID access and add glFinish() after demo -> FBO rendering on or off thread.

Fixes shared GLContext OSX rendering.
*External*Context Impl: Remove unused 'lastContext' field, incl. their makeCurrent() and release() override.

Semantics of 'lastContext' are plain wrong, since release() override does claim the previous 'lastContext'
is current at the end - however, it wasn't technically made current.
MemoryObject: Use GlueGen's new HashUtil

GlueGen commit 1a4514accc8f61ab7ff5fe8c82d22a5ef356c865
Bug 665: Allow re-association of GLContext/GLEventListener to a GLDrawable (Part 4)

Note:

  - GLEventListenerState preservs the GLAutoDrawable state,
    i.e. GLContext, all GLEventListener and the GLAnimatorControl association.

  - GLEventListenerState may be utilized to move the state from a dying GLAutoDrawable,
    to be moved to a new created GLAutoDrawable at a later time.

  - GLEventListenerState will be made public soon.

+++

Exessive unit tests cover the new feature, tested manually on GNU/Linux/X11 and OSX(Java6/Java7).

+++

- GLAutoDrawable
  - Change 'setContext(..)' to allow the destruction of the unbound old context:
      'setContext(GLContext newCtx)' -> 'setContext(GLContext newCtx, boolean destroyPrevCtx)'

  - Implementations: Properly implement 'setRealized(..)' incl. obeying threading constraints if exists.
    Method is being utilized at least for GLEventListenerState.moveTo(..)
    to unrealize and realize the drawable resources.

+++

Fix propagation of GLContext/GLDrawable association change (Bottom -> Top):

  GLDrawableImpl.associateContext
      GLContextImpl.associateDrawable
          GLContextImpl.makeCurrent
          GLContextImpl.destroy
          GLContext.setGLDrawable
              ...
              GLDrawableHelper.switchContext
                  GLAutoDrawble.setContext

associateDrawable(..)/associateContext(..) unifies and hence:
    - GLContextImpl.contextRealized() (removed)
    - GLDrawableImpl.contextRealized() (removed)
    - GLDrawableImpl.associateContext(..) (merged)
    - MacOSXCGLContext.drawableChangedNotify(..) (removed)

+++

- EGLUpstreamSurfaceHook.evalUpstreamSurface() validates the surface's device for reusage,
  which is valid in case of GLEventListenerState.moveTo(..)

- MacOSXCGLContext.NSOpenGLImpl: pixelFormat replaces NSOpenGLLayerPfmt and has simplified lifecycle [create..destroy],
  while native NSOpenGLLayer code only holds the reference until released.
Bug 665: Allow re-association of GLContext/GLEventListener to a GLDrawable (Part 5)

- GLAutoDrawableBase:

  - Add 'setPreserveGLStateAtDestroy(..)' to preserve the GLEventListenerState at destroy() operation,
    and impl. details pullGLEventListenerState()/pushGLEventListenerState().
    pullGLEventListenerState() is called automatic at destroyImplInLock(),
    where pushGLEventListenerState() has to be called after drawable realization
    instead of context creation.

  - Note/TODO: Method will become public in GLAutoDrawable in general!

- NEWT/GLWindow:
  - Use GLEventListenerState preservation for reparenting case w/ destruction,
    i.e. keep GLContext/GLEventListener alive while reparenting in recreation mode.

    Scenario: NewtCanvasAWT Child <-> Top on OSX w/ CALayer
Minor Changes: EGLDisplayUtil: Add stack trace in DEBUG mode for opened DPYs; JAWTWindow: Add JAWT info in toString()
GLEventListenerState: Moved to public package 'com.jogamp.opengl.util'
Fix TestParenting01NEWT: Since recreational reparenting resets the fps-counter, wait for a few frames!
OSX/CALayer: Revise CALayer 'RunOnMainThread' utilization, avoiding deadlocks

RunOnMainThread(waitUntilDone:=true,..) can deadlock the main-thread if called from AWT-EDT,
since the main-thread may call back to AWT-EDT while injecting a new main-thread task.

This patch revises all RunOnMainThread CALayer usage, resulting in only one required left:
  - OSXUtil.AddCASublayer() w/ waitUntilDone:=false

Hence the CALayer code has no more potential to deadlock main-thread/AWT-EDT.

OSXUtil.AddCASublayer() must be performed on main-thread, otherwise the
CALayer attachment will fail - no visible rendering result.

+++

Note: A good trigger to test this deadlock is to magnify/zoom
      the OSX desktop (click background + ctrl-mouse_wheel)
      before running some unit tests.

      TestGLCanvasAWTActionDeadlock01AWT and TestAddRemove02GLWindowNewtCanvasAWT
      also have the potential to trigger the mentioned deadlock.
OSX/CALayer: Simplify FixCALayerLayout()/layoutSurfaceLayer() call, no more need for explicit call

- OffscreenLayerSurface.layoutSurfaceLayer() removed, no more required

- JAWTWindow adds a ComponentListener, which issues FixCALayerLayout() at resized, moved and shown.

- MyNSOpenGLLayer no more requires fix*Size() methods

- MyNSOpenGLLayer::setDedicatedSize() need no explicit CATransaction, performed by caller.
Fix NEWT WindowImpl reparent-recreate w/ GLEventListenerState: Bug introduced w/ commit e2506d7663b752f00f0a98f793ebad52e65bd1e3

In case a reparent action takes place w/ recreate,
only preserve the GLEventListenerState if the window is valid and will become visible again (wasVisible).

Also add proper DEBUG log prefix to GLEventListenerState.
Remodel OSX/CALayer Threading (commit 896e8b021b39e9415040a57a1d540d7d24b02db1): Run on main-thread w/o blocking ; Misc Changes

Commit 896e8b021b39e9415040a57a1d540d7d24b02db1 moved all native CALayer calls to the current thread
to avoid deadlocks.

Even though this seemed to be fine at least resource GC (release/dealloc calls) were issued
very late in time, probably due to multithreading synchronization of JAWT and/or OSX API.

Example: Our 'TestAddRemove01GLCanvasSwingAWT' test didn't freed CALayer resources incl. GL ctx
         when destroying the objects (AWT Frame, GLCanvas, ..), leading to resource starvation .. eventually.

Remedy is a compromise of behavior before commit 896e8b021b39e9415040a57a1d540d7d24b02db1
and that commit, i.e. to run CALayer lifecycle methods on main-thread, but do not block!

The careful part within MacOSXCGLContext.associateDrawable(..) performs the following block on main-thread:
  - lock the context
  - create NSOpenGLLayer (incl. it's own shared GL context and the DisplayLink)
  - attach NSOpenGLLayer to root CALayer
  - unlock the context

Due to the GL ctx locking, this async offthread operation is safe within our course of operations.

Details:
  - NSOpenGLContext
    - Context and CVDisplayLink creation at init
    - Call [ctx update] if texture/frame size changed
    - 'waitUntilRenderSignal' uses default TO value if given TO is 0 to avoid deadlocks

+++

Misc Changes:
  - Fix object type detection: isMemberOfClass -> isKindOfClass
    - OSXUtil_isNSView0
      OSXUtil_isNSWindow0,
      CGL_isNSOpenGLPixelBuffer

  - MacOSXCGLDrawable/MacOSXPbufferCGLDrawable: remove getNSViewHandle() method.
    MacOSXCGLContext uses common code to detect nature of the drawable handle.

  - MacOSXCGLContext/CALayer: Use safe screenVSyncTimeout values, never 0 to avoid deadlock!

  - JAWTWindow.invalidate: Call detachSurfaceLayer() if not done yet
Adapt to GlueGen commit b1eb7ca6b9d7dec7ff62c1f1e8ef0a0545724d2f: Function- RunnableTask adds PrintStream 'exceptionOut' argument in ctor.
NativeWindow OSXUtil RunOnMainThread: Use daemon attachment and do not detach; Add RunLater0(..)
OSX CGL: Don't issue [NSOpenGLContext clearDrawable] for [NSOpenGLContext setView: view] which breaks pbuffer; Add [NSOpenGLContext clearDrawable].
MyNSOpenGLContext::dealloc: Avoid 'invalid context'