From 4b9ad2508ff31a03d3bc4482d812a6cbc0c5c33b Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 3 Dec 2010 21:32:16 +0100
Subject: Cleanup GLDrawableFactory API and platform Implementations

- Finish API change using the AbstractGraphicsDevice, which denotes the target device
  for the desired NativeSurface / GLDrawable.
  The AbstractGraphicsDevice argument may be null to reflect the platform's default device.
  Clarified API documentation.
  This move is necessary to make the API coherent.

- createOffscreenDrawable(..) may create a Pbuffer drawable if caps and supported.
  This unifies the functionality with createGLDrawable(..).
  Further more, a Pbuffer drawable is an offscreen as well.

- added createOffscreenSurface(..) following the same behavior as createOffscreenDrawable(..),
  this is a convenient native offscreen surface factory entry.

- removed createGLPbufferDrawable(..), use createOffscreenDrawable(..),
  since it is redundant!

Implementation Details:

- EGLDrawableFactory holds a shared native EGLGraphicsDevice,
  being used by the offscreen EGL drawable (no more multiple creation).
---
 .../jogamp/opengl/impl/GLDrawableFactoryImpl.java  | 142 ++++++++++++++------
 .../com/jogamp/opengl/impl/egl/EGLDrawable.java    |   2 +-
 .../jogamp/opengl/impl/egl/EGLDrawableFactory.java |  75 ++++++++---
 .../impl/egl/EGLGraphicsConfigurationFactory.java  |  19 +--
 .../impl/macosx/cgl/MacOSXCGLDrawableFactory.java  |  25 ++--
 .../impl/windows/wgl/WindowsBitmapWGLContext.java  |  64 +++++++++
 .../impl/windows/wgl/WindowsBitmapWGLDrawable.java | 145 +++++++++++++++++++++
 .../windows/wgl/WindowsOffscreenWGLContext.java    |  64 ---------
 .../windows/wgl/WindowsOffscreenWGLDrawable.java   | 145 ---------------------
 .../opengl/impl/windows/wgl/WindowsWGLContext.java |  13 +-
 .../windows/wgl/WindowsWGLDrawableFactory.java     |  80 +++++++-----
 .../opengl/impl/x11/glx/X11GLXDrawableFactory.java |  73 ++++++-----
 .../glx/X11GLXGraphicsConfigurationFactory.java    |  50 -------
 .../impl/x11/glx/X11OffscreenGLXContext.java       |  70 ----------
 .../impl/x11/glx/X11OffscreenGLXDrawable.java      | 137 -------------------
 .../opengl/impl/x11/glx/X11PixmapGLXContext.java   |  70 ++++++++++
 .../opengl/impl/x11/glx/X11PixmapGLXDrawable.java  | 137 +++++++++++++++++++
 .../javax/media/opengl/GLDrawableFactory.java      |  85 ++++++++----
 .../classes/javax/media/opengl/awt/GLJPanel.java   |   4 +-
 19 files changed, 756 insertions(+), 644 deletions(-)
 create mode 100644 src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsBitmapWGLContext.java
 create mode 100644 src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsBitmapWGLDrawable.java
 delete mode 100644 src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java
 delete mode 100644 src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
 delete mode 100644 src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
 delete mode 100644 src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
 create mode 100644 src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PixmapGLXContext.java
 create mode 100644 src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PixmapGLXDrawable.java

(limited to 'src/jogl/classes')

diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
index ef5f67081..01e0b8298 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
@@ -55,7 +55,33 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
   protected GLDrawableFactoryImpl() {
     super();
   }
-  
+
+  /**
+   * Returns the shared device mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()},
+   * either a preexisting or newly created, or <code>null</code> if creation failed or not supported.<br>
+   * Creation of the shared context is tried only once.
+   *
+   * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
+   */
+  protected final AbstractGraphicsDevice getOrCreateSharedDevice(AbstractGraphicsDevice device) {
+      if(null==device) {
+          device = getDefaultDevice();
+          if(null==device) {
+              throw new InternalError("no default device");
+          }
+          if (GLProfile.DEBUG) {
+              System.err.println("Info: GLDrawableFactoryImpl.getOrCreateSharedContext: using default device : "+device);
+          }
+      } else if( !getIsDeviceCompatible(device) ) {
+          if (GLProfile.DEBUG) {
+              System.err.println("Info: GLDrawableFactoryImpl.getOrCreateSharedContext: device not compatible : "+device);
+          }
+          return null;
+      }
+      return getOrCreateSharedDeviceImpl(device);
+  }
+  protected abstract AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device);
+
   /** 
    * Returns the GLDynamicLookupHelper
    * @param profile if EGL/ES, profile <code>1</code> refers to ES1 and <code>2</code> to ES2,
@@ -85,18 +111,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
             if( ! ( target instanceof SurfaceChangeable ) ) {
                 throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen: "+target);
             }
-            if(caps.isPBuffer() && canCreateGLPbuffer(adevice)) {
-                if(DEBUG) {
-                    System.err.println("GLDrawableFactoryImpl.createGLDrawable -> PbufferDrawable: "+target);
-                }
-                result = createGLPbufferDrawable(target);
-            }
-            if(null==result) {
-                if(DEBUG) {
-                    System.err.println("GLDrawableFactoryImpl.createGLDrawable -> OffScreenDrawable: "+target);
-                }
-                result = createOffscreenDrawableImpl(target);
+            if(DEBUG) {
+                System.err.println("GLDrawableFactoryImpl.createGLDrawable -> OffScreenDrawable (PBuffer: "+caps.isPBuffer()+"): "+target);
             }
+            result = createOffscreenDrawableImpl(target);
         }
     } finally {
         adevice.unlock();
@@ -121,20 +139,12 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
 
   public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device);
 
-  /** Target must implement SurfaceChangeable */
-  protected abstract GLDrawableImpl createGLPbufferDrawableImpl(NativeSurface target);
-
-  private GLDrawableImpl createGLPbufferDrawable(NativeSurface target) {
-    if (!canCreateGLPbuffer(target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice())) {
-        throw new GLException("Pbuffer support not available with current graphics card");
-    }
-    return createGLPbufferDrawableImpl(target);
-  }
-  
-  public GLDrawable createGLPbufferDrawable(GLCapabilitiesImmutable capsRequested,
-                                            GLCapabilitiesChooser chooser,
-                                            int width,
-                                            int height) {
+  public GLPbuffer createGLPbuffer(AbstractGraphicsDevice deviceReq,
+                                   GLCapabilitiesImmutable capsRequested,
+                                   GLCapabilitiesChooser chooser,
+                                   int width,
+                                   int height,
+                                   GLContext shareWith) {
     if(height<=0 || height<=0) {
         throw new GLException("Width and height of pbuffer must be positive (were (" +
                         width + ", " + height + "))");
@@ -142,6 +152,15 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
 
     GLCapabilitiesImmutable capsChosen;
 
+    AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq);
+    if(null == device) {
+        throw new GLException("No shared device for requested: "+deviceReq);
+    }
+
+    if (!canCreateGLPbuffer(device)) {
+        throw new GLException("Pbuffer support not available with device: "+device);
+    }
+
     if( capsRequested.getDoubleBuffered() || capsRequested.isOnscreen() || !capsRequested.isPBuffer()) {
         // fix caps ..
         GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
@@ -152,21 +171,19 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
     } else {
         capsChosen = capsRequested;
     }
-    NativeWindowFactory.getDefaultToolkitLock().lock();
+
+    GLDrawableImpl drawable = null;
+    device.lock();
     try {
-        return createGLPbufferDrawable( createOffscreenSurfaceImpl(capsChosen, capsRequested, chooser, height, height) );
+        drawable = (GLDrawableImpl) createGLDrawable( createOffscreenSurfaceImpl(device, capsChosen, capsRequested, chooser, height, height) );
     } finally {
-        NativeWindowFactory.getDefaultToolkitLock().unlock();
+        device.unlock();
     }
-  }
 
-  public GLPbuffer createGLPbuffer(GLCapabilitiesImmutable capabilities,
-                                   GLCapabilitiesChooser chooser,
-                                   int width,
-                                   int height,
-                                   GLContext shareWith) {
-    return new GLPbufferImpl( (GLDrawableImpl) createGLPbufferDrawable(capabilities, chooser, height, height),
-                              shareWith);
+    if(null==drawable) {
+        throw new GLException("Could not create Pbuffer drawable for: "+device+", "+capsChosen+", "+width+"x"+height);
+    }
+    return new GLPbufferImpl( drawable, shareWith);
   }
 
 
@@ -177,7 +194,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
 
   protected abstract GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) ;
 
-  public GLDrawable createOffscreenDrawable(GLCapabilitiesImmutable capsRequested,
+  public GLDrawable createOffscreenDrawable(AbstractGraphicsDevice deviceReq,
+                                            GLCapabilitiesImmutable capsRequested,
                                             GLCapabilitiesChooser chooser,
                                             int width,
                                             int height) {
@@ -185,6 +203,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
         throw new GLException("Width and height of pbuffer must be positive (were (" +
                         width + ", " + height + "))");
     }
+    AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq);
+    if(null == device) {
+        throw new GLException("No shared device for requested: "+deviceReq);
+    }
     GLCapabilitiesImmutable capsChosen;
 
     if( capsRequested.getDoubleBuffered() || capsRequested.isOnscreen() || capsRequested.isPBuffer()) {
@@ -192,16 +214,49 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
         GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
         caps2.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
         caps2.setOnscreen(false);
-        caps2.setPBuffer(false);
+        if(caps2.isPBuffer() && !canCreateGLPbuffer(device)) {
+            caps2.setPBuffer(false);
+        }
         capsChosen = caps2;
     } else {
         capsChosen = capsRequested;
     }
-    NativeWindowFactory.getDefaultToolkitLock().lock();
+    device.lock();
     try {
-        return createOffscreenDrawableImpl( createOffscreenSurfaceImpl(capsChosen, capsRequested, chooser, width, height) );
+        return createGLDrawable( createOffscreenSurfaceImpl(device, capsChosen, capsRequested, chooser, width, height) );
     } finally {
-        NativeWindowFactory.getDefaultToolkitLock().unlock();
+        device.unlock();
+    }
+  }
+
+  public NativeSurface createOffscreenSurface(AbstractGraphicsDevice deviceReq,
+                                              GLCapabilitiesImmutable capsRequested,
+                                              GLCapabilitiesChooser chooser,
+                                              int width, int height) {
+    GLCapabilitiesImmutable capsChosen;
+
+    AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq);
+    if(null == device) {
+        throw new GLException("No shared device for requested: "+deviceReq);
+    }
+
+    if( capsRequested.getDoubleBuffered() || capsRequested.isOnscreen() || capsRequested.isPBuffer()) {
+        // fix caps ..
+        GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
+        caps2.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
+        caps2.setOnscreen(false);
+        if(caps2.isPBuffer() && !canCreateGLPbuffer(device)) {
+            caps2.setPBuffer(false);
+        }
+        capsChosen = caps2;
+    } else {
+        capsChosen = capsRequested;
+    }
+    device.lock();
+    try {
+        return createOffscreenSurfaceImpl(device, capsChosen, capsRequested, chooser, width, height);
+    } finally {
+        device.unlock();
     }
   }
 
@@ -209,7 +264,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
    * creates an offscreen NativeSurface, which must implement SurfaceChangeable as well,
    * so the windowing system related implementation is able to set the surface handle.
    */
-  protected abstract NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capabilities, GLCapabilitiesImmutable capsRequested,
+  protected abstract NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device,
+                                                              GLCapabilitiesImmutable capabilities, GLCapabilitiesImmutable capsRequested,
                                                               GLCapabilitiesChooser chooser,
                                                               int width, int height);
 
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
index 88685faf7..4120b0167 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
@@ -166,7 +166,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
                 if (!EGL.eglInitialize(eglDisplay, null, null)) {
                     throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError()));
                 }
-                EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_UNIT);
+                EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
                 DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, aConfig.getScreen().getIndex());
                 // yes, use the already choosen/requested Capabilities (x11,win32,..)
                 GLCapabilitiesImmutable capsChosen = (GLCapabilitiesImmutable) aConfig.getChosenCapabilities();
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
index 737aa5519..f451cb9bc 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
@@ -95,17 +95,20 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
 
     public EGLDrawableFactory() {
         super();
-        defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
+        defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
     }
 
     static class SharedResource {
-      private EGLDrawable drawable;
-      private EGLContext context;
-
-      SharedResource(EGLDrawable draw, EGLContext ctx) {
-          drawable = draw;
-          context = ctx;
+      private EGLGraphicsDevice device;
+      //private EGLDrawable drawable;
+      //private EGLContext context;
+
+      SharedResource(EGLGraphicsDevice dev /*, EGLDrawable draw, EGLContext ctx */) {
+          device = dev;
+          // drawable = draw;
+          // context = ctx;
       }
+      EGLGraphicsDevice getDevice() { return device; }
     }
     HashMap/*<connection, SharedResource>*/ sharedMap = new HashMap();
     EGLGraphicsDevice defaultDevice;
@@ -121,8 +124,45 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
       return false;
     }
 
+    private SharedResource getOrCreateShared(AbstractGraphicsDevice device) {
+        String connection = device.getConnection();
+        SharedResource sr;
+        synchronized(sharedMap) {
+            sr = (SharedResource) sharedMap.get(connection);
+        }
+        if(null==sr) {
+            long eglDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
+            if (eglDisplay == EGL.EGL_NO_DISPLAY) {
+                throw new GLException("Failed to created EGL default display: error 0x"+Integer.toHexString(EGL.eglGetError()));
+            } else if(DEBUG) {
+                System.err.println("eglDisplay(EGL_DEFAULT_DISPLAY): 0x"+Long.toHexString(eglDisplay));
+            }
+            if (!EGL.eglInitialize(eglDisplay, null, null)) {
+                throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError()));
+            }
+            EGLGraphicsDevice sharedDevice = new EGLGraphicsDevice(eglDisplay, connection, device.getUnitID());
+            sr = new SharedResource(sharedDevice);
+            synchronized(sharedMap) {
+                sharedMap.put(connection, sr);
+            }
+            if (DEBUG) {
+              System.err.println("!!! SharedDevice: "+sharedDevice);
+            }
+        }
+        return sr;
+    }
+
+
     protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
-        // FIXME: not implemented .. needs a dummy EGL surface
+        // FIXME: not implemented .. needs a dummy EGL surface - NEEDED ?
+        return null;
+    }
+
+    protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
+        SharedResource sr = getOrCreateShared(device);
+        if(null!=sr) {
+            return sr.getDevice();
+        }
         return null;
     }
 
@@ -152,19 +192,24 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
     }
 
     protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) {
-        throw new GLException("Not yet implemented");
+        if (target == null) {
+          throw new IllegalArgumentException("Null target");
+        }
+        AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+        GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+        if(!caps.isPBuffer()) {
+            throw new GLException("Not yet implemented");
+        }
+        // PBuffer GLDrawable Creation
+        return new EGLPbufferDrawable(this, target);
     }
 
     public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
         return true;
     }
 
-    protected GLDrawableImpl createGLPbufferDrawableImpl(NativeSurface target) {
-        return new EGLPbufferDrawable(this, target);
-    }
-
-    protected NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
-        ProxySurface ns = new ProxySurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(capsChosen, capsRequested, chooser));
+    protected NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
+        ProxySurface ns = new ProxySurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(device, capsChosen, capsRequested, chooser));
         ns.setSize(width, height);
         return ns;
     }
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
index a9c8652b0..fc2416cb9 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
@@ -291,7 +291,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
         }
     }
 
-    static EGLGraphicsConfiguration createOffscreenGraphicsConfiguration(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsReq, GLCapabilitiesChooser chooser) {
+    static EGLGraphicsConfiguration createOffscreenGraphicsConfiguration(AbstractGraphicsDevice device, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsReq, GLCapabilitiesChooser chooser) {
         if(capsChosen.isOnscreen()) {
             throw new GLException("Error: Onscreen set: "+capsChosen);
         }
@@ -303,21 +303,10 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
             capsChosen = caps2;
         }
 
-        long eglDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
-        if (eglDisplay == EGL.EGL_NO_DISPLAY) {
-            throw new GLException("Failed to created EGL default display: error 0x"+Integer.toHexString(EGL.eglGetError()));
-        } else if(DEBUG) {
-            System.err.println("eglDisplay(EGL_DEFAULT_DISPLAY): 0x"+Long.toHexString(eglDisplay));
-        }
-        if (!EGL.eglInitialize(eglDisplay, null, null)) {
-            throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError()));
-        }
-        EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_UNIT);
-        DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, 0);
-        EGLGraphicsConfiguration eglConfig = chooseGraphicsConfigurationStatic(capsChosen, capsReq, chooser, s);
+        DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
+        EGLGraphicsConfiguration eglConfig = chooseGraphicsConfigurationStatic(capsChosen, capsReq, chooser, screen);
         if (null == eglConfig) {
-            EGL.eglTerminate(eglDisplay);
-            throw new GLException("Couldn't create EGLGraphicsConfiguration from "+s);
+            throw new GLException("Couldn't create EGLGraphicsConfiguration from "+screen);
         } else if(DEBUG) {
             System.err.println("Chosen eglConfig: "+eglConfig);
         }
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 71b99c2d5..1895c8e67 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -117,6 +117,10 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
         return null;
   }
 
+  protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
+      return device; // nothing to do, no native open device
+  }
+
   protected final void shutdownInstance() {}
 
   protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) {
@@ -127,15 +131,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
   }
 
   protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) {
-    return new MacOSXOffscreenCGLDrawable(this, target);
-  }
-
-  public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
-    return true;
-  }
+    AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+    GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+    if(!caps.isPBuffer()) {
+        return new MacOSXOffscreenCGLDrawable(this, target);
+    }
 
-  protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeSurface target) {
-    /** 
+    // PBuffer GLDrawable Creation
+    /**
      * FIXME: Think about this ..
      * should not be necessary ? ..
     final List returnList = new ArrayList();
@@ -151,7 +154,11 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
     return new MacOSXPbufferCGLDrawable(this, target);
   }
 
-  protected NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
+  public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
+    return true;
+  }
+
+  protected NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device,GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
     AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX);
     ProxySurface ns = new ProxySurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, true));
     ns.setSize(width, height);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsBitmapWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsBitmapWGLContext.java
new file mode 100644
index 000000000..7b769d971
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsBitmapWGLContext.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * 
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.opengl.impl.windows.wgl;
+
+import javax.media.opengl.*;
+
+public class WindowsBitmapWGLContext extends WindowsWGLContext {
+  public WindowsBitmapWGLContext(WindowsBitmapWGLDrawable drawable,
+                                   GLContext shareWith) {
+    super(drawable, shareWith);
+  }
+
+  public int getOffscreenContextPixelDataType() {
+      return GL.GL_UNSIGNED_BYTE;
+  }
+  
+  public int getOffscreenContextReadBuffer() {
+    // On Windows these contexts are always single-buffered
+    return GL.GL_FRONT;
+  }
+
+  public boolean offscreenImageNeedsVerticalFlip() {
+    // We can take care of this in the DIB creation (see below)
+    return false;
+  }
+}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsBitmapWGLDrawable.java
new file mode 100644
index 000000000..0d360b339
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsBitmapWGLDrawable.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * 
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.opengl.impl.windows.wgl;
+
+import javax.media.nativewindow.NativeSurface;
+import javax.media.nativewindow.SurfaceChangeable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLException;
+
+import com.jogamp.nativewindow.impl.windows.BITMAPINFO;
+import com.jogamp.nativewindow.impl.windows.BITMAPINFOHEADER;
+import com.jogamp.nativewindow.impl.windows.GDI;
+import javax.media.opengl.GLCapabilitiesImmutable;
+
+public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable {
+  private long origbitmap;
+  private long hbitmap;
+
+  protected WindowsBitmapWGLDrawable(GLDrawableFactory factory, NativeSurface target) {
+    super(factory, target, true);
+    create();
+  }
+
+  protected void setRealizedImpl() {
+    if(realized) {
+        create();
+    } else {
+        destroyImpl();
+    }
+  }
+
+  public GLContext createContext(GLContext shareWith) {
+    return new WindowsBitmapWGLContext(this, shareWith);
+  }
+
+  private void create() {
+    NativeSurface ns = getNativeSurface();
+    WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+    GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getRequestedCapabilities();
+    int width = getWidth();
+    int height = getHeight();
+    BITMAPINFO info = BITMAPINFO.create();
+    BITMAPINFOHEADER header = info.getBmiHeader();
+    int bitsPerPixel = (capabilities.getRedBits() +
+                        capabilities.getGreenBits() +
+                        capabilities.getBlueBits() +
+                        capabilities.getAlphaBits());
+    header.setBiSize(header.size());
+    header.setBiWidth(width);
+    // NOTE: negating the height causes the DIB to be in top-down row
+    // order rather than bottom-up; ends up being correct during pixel
+    // readback
+    header.setBiHeight(-1 * height);
+    header.setBiPlanes((short) 1);
+    header.setBiBitCount((short) bitsPerPixel);
+    header.setBiXPelsPerMeter(0);
+    header.setBiYPelsPerMeter(0);
+    header.setBiClrUsed(0);
+    header.setBiClrImportant(0);
+    header.setBiCompression(GDI.BI_RGB);
+    header.setBiSizeImage(width * height * bitsPerPixel / 8);
+
+    long hdc = GDI.CreateCompatibleDC(0);
+    if (hdc == 0) {
+      System.out.println("LastError: " + GDI.GetLastError());
+      throw new GLException("Error creating device context for offscreen OpenGL context");
+    }
+    ((SurfaceChangeable)ns).setSurfaceHandle(hdc);
+
+    hbitmap = GDI.CreateDIBSection(hdc, info, GDI.DIB_RGB_COLORS, null, 0, 0);
+    if (hbitmap == 0) {
+      GDI.DeleteDC(hdc);
+      hdc = 0;
+      throw new GLException("Error creating offscreen bitmap of width " + width +
+                            ", height " + height);
+    }
+    if ((origbitmap = GDI.SelectObject(hdc, hbitmap)) == 0) {
+      GDI.DeleteObject(hbitmap);
+      hbitmap = 0;
+      GDI.DeleteDC(hdc);
+      hdc = 0;
+      throw new GLException("Error selecting bitmap into new device context");
+    }
+    config.updateGraphicsConfiguration(getFactory(), ns);
+  }
+  
+  protected void destroyImpl() {
+    NativeSurface ns = getNativeSurface();
+    if (ns.getSurfaceHandle() != 0) {
+      // Must destroy bitmap and device context
+      GDI.SelectObject(ns.getSurfaceHandle(), origbitmap);
+      GDI.DeleteObject(hbitmap);
+      GDI.DeleteDC(ns.getSurfaceHandle());
+      origbitmap = 0;
+      hbitmap = 0;
+      ((SurfaceChangeable)ns).setSurfaceHandle(0);
+    }
+  }
+
+  protected void swapBuffersImpl() {
+    if(DEBUG) {
+        System.err.println("unhandled swapBuffersImpl() called for: "+this);
+    }
+  }
+
+}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java
deleted file mode 100644
index 25d93b50e..000000000
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * 
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.opengl.impl.windows.wgl;
-
-import javax.media.opengl.*;
-import com.jogamp.opengl.impl.*;
-
-public class WindowsOffscreenWGLContext extends WindowsWGLContext {
-  public WindowsOffscreenWGLContext(WindowsOffscreenWGLDrawable drawable,
-                                   GLContext shareWith) {
-    super(drawable, shareWith);
-  }
-
-  public int getOffscreenContextPixelDataType() {
-      return GL.GL_UNSIGNED_BYTE;
-  }
-  
-  public int getOffscreenContextReadBuffer() {
-    // On Windows these contexts are always single-buffered
-    return GL.GL_FRONT;
-  }
-
-  public boolean offscreenImageNeedsVerticalFlip() {
-    // We can take care of this in the DIB creation (see below)
-    return false;
-  }
-}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
deleted file mode 100644
index 3452d3b55..000000000
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright (c) 2010 JogAmp Community. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * 
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.opengl.impl.windows.wgl;
-
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.SurfaceChangeable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-
-import com.jogamp.nativewindow.impl.windows.BITMAPINFO;
-import com.jogamp.nativewindow.impl.windows.BITMAPINFOHEADER;
-import com.jogamp.nativewindow.impl.windows.GDI;
-import javax.media.opengl.GLCapabilitiesImmutable;
-
-public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
-  private long origbitmap;
-  private long hbitmap;
-
-  protected WindowsOffscreenWGLDrawable(GLDrawableFactory factory, NativeSurface target) {
-    super(factory, target, true);
-    create();
-  }
-
-  protected void setRealizedImpl() {
-    if(realized) {
-        create();
-    } else {
-        destroyImpl();
-    }
-  }
-
-  public GLContext createContext(GLContext shareWith) {
-    return new WindowsOffscreenWGLContext(this, shareWith);
-  }
-
-  private void create() {
-    NativeSurface ns = getNativeSurface();
-    WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
-    GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getRequestedCapabilities();
-    int width = getWidth();
-    int height = getHeight();
-    BITMAPINFO info = BITMAPINFO.create();
-    BITMAPINFOHEADER header = info.getBmiHeader();
-    int bitsPerPixel = (capabilities.getRedBits() +
-                        capabilities.getGreenBits() +
-                        capabilities.getBlueBits() +
-                        capabilities.getAlphaBits());
-    header.setBiSize(header.size());
-    header.setBiWidth(width);
-    // NOTE: negating the height causes the DIB to be in top-down row
-    // order rather than bottom-up; ends up being correct during pixel
-    // readback
-    header.setBiHeight(-1 * height);
-    header.setBiPlanes((short) 1);
-    header.setBiBitCount((short) bitsPerPixel);
-    header.setBiXPelsPerMeter(0);
-    header.setBiYPelsPerMeter(0);
-    header.setBiClrUsed(0);
-    header.setBiClrImportant(0);
-    header.setBiCompression(GDI.BI_RGB);
-    header.setBiSizeImage(width * height * bitsPerPixel / 8);
-
-    long hdc = GDI.CreateCompatibleDC(0);
-    if (hdc == 0) {
-      System.out.println("LastError: " + GDI.GetLastError());
-      throw new GLException("Error creating device context for offscreen OpenGL context");
-    }
-    ((SurfaceChangeable)ns).setSurfaceHandle(hdc);
-
-    hbitmap = GDI.CreateDIBSection(hdc, info, GDI.DIB_RGB_COLORS, null, 0, 0);
-    if (hbitmap == 0) {
-      GDI.DeleteDC(hdc);
-      hdc = 0;
-      throw new GLException("Error creating offscreen bitmap of width " + width +
-                            ", height " + height);
-    }
-    if ((origbitmap = GDI.SelectObject(hdc, hbitmap)) == 0) {
-      GDI.DeleteObject(hbitmap);
-      hbitmap = 0;
-      GDI.DeleteDC(hdc);
-      hdc = 0;
-      throw new GLException("Error selecting bitmap into new device context");
-    }
-    config.updateGraphicsConfiguration(getFactory(), ns);
-  }
-  
-  protected void destroyImpl() {
-    NativeSurface ns = getNativeSurface();
-    if (ns.getSurfaceHandle() != 0) {
-      // Must destroy bitmap and device context
-      GDI.SelectObject(ns.getSurfaceHandle(), origbitmap);
-      GDI.DeleteObject(hbitmap);
-      GDI.DeleteDC(ns.getSurfaceHandle());
-      origbitmap = 0;
-      hbitmap = 0;
-      ((SurfaceChangeable)ns).setSurfaceHandle(0);
-    }
-  }
-
-  protected void swapBuffersImpl() {
-    if(DEBUG) {
-        System.err.println("unhandled swapBuffersImpl() called for: "+this);
-    }
-  }
-
-}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
index 53badb25e..e85308371 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
@@ -111,10 +111,15 @@ public class WindowsWGLContext extends GLContextImpl {
         WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl();
         AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
         AbstractGraphicsDevice device = config.getScreen().getDevice();
-        WindowsWGLDrawableFactory.SharedResource sr = factory.getOrCreateShared(device);
-        if(null != sr) {
-            wglMakeContextCurrentAvailable = factory.isReadDrawableAvailable(device);
-            wglMakeContextCurrentInitialized=true;
+        switch( factory.isReadDrawableAvailable(device) ) {
+            case  1:
+                wglMakeContextCurrentAvailable = true;
+                wglMakeContextCurrentInitialized=true;
+                break;
+            case  0:
+                wglMakeContextCurrentAvailable = false;
+                wglMakeContextCurrentInitialized=true;
+                break;
         }
     }
     return wglMakeContextCurrentAvailable;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
index 99e78b184..903e1af81 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -69,6 +69,7 @@ import com.jogamp.opengl.impl.DesktopGLDynamicLookupHelper;
 import com.jogamp.opengl.impl.GLDrawableFactoryImpl;
 import com.jogamp.opengl.impl.GLDrawableImpl;
 import com.jogamp.opengl.impl.GLDynamicLookupHelper;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
 import javax.media.opengl.GLCapabilitiesImmutable;
 
 public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
@@ -110,17 +111,21 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
   }
 
   static class SharedResource {
+      private WindowsGraphicsDevice device;
       private WindowsDummyWGLDrawable drawable;
       private WindowsWGLContext context;
       private boolean canCreateGLPbuffer;
       private boolean readDrawableAvailable;
 
-      SharedResource(WindowsDummyWGLDrawable draw, WindowsWGLContext ctx, boolean readBufferAvail, boolean canPbuffer) {
+      SharedResource(WindowsGraphicsDevice dev, WindowsDummyWGLDrawable draw, WindowsWGLContext ctx,
+                     boolean readBufferAvail, boolean canPbuffer) {
+          device = dev;
           drawable = draw;
           context = ctx;
           canCreateGLPbuffer = canPbuffer;
           readDrawableAvailable = readBufferAvail;
       }
+      WindowsGraphicsDevice getDevice() { return device; }
       WindowsWGLContext getContext() { return context; }
       boolean canCreateGLPbuffer() { return canCreateGLPbuffer; }
       boolean isReadDrawableAvailable() { return readDrawableAvailable; }
@@ -156,7 +161,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
   final static String WGL_ARB_make_current_read = "WGL_ARB_make_current_read";
   final static String wglMakeContextCurrent = "wglMakeContextCurrent";
 
-  protected final SharedResource getOrCreateShared(AbstractGraphicsDevice device) {
+  private SharedResource getOrCreateShared(AbstractGraphicsDevice device) {
     String connection = device.getConnection();
     SharedResource sr;
     synchronized(sharedMap) {
@@ -166,16 +171,19 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
         addDeviceTried(connection);
         NativeWindowFactory.getDefaultToolkitLock().lock(); // OK
         try {
-            WindowsDummyWGLDrawable sharedDrawable = WindowsDummyWGLDrawable.create(this, null);
+            WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT);
+            GLProfile glp = GLProfile.getDefault(/*sharedDevice*/); // can't fetch device profile, which shared resource we create here
+            AbstractGraphicsScreen absScreen = new DefaultGraphicsScreen(sharedDevice, 0);
+            WindowsDummyWGLDrawable sharedDrawable = WindowsDummyWGLDrawable.create(this, glp, absScreen);
             WindowsWGLContext ctx  = (WindowsWGLContext) sharedDrawable.createContext(null);
             ctx.makeCurrent();
             boolean canCreateGLPbuffer = ctx.getGL().isExtensionAvailable(GL_ARB_pbuffer);
             boolean readDrawableAvailable = ctx.isExtensionAvailable(WGL_ARB_make_current_read) &&
                                                      ctx.isFunctionAvailable(wglMakeContextCurrent);
             ctx.release();
-            sr = new SharedResource(sharedDrawable, ctx, readDrawableAvailable, canCreateGLPbuffer);
+            sr = new SharedResource(sharedDevice, sharedDrawable, ctx, readDrawableAvailable, canCreateGLPbuffer);
             synchronized(sharedMap) {
-                sharedMap.put(device.getConnection(), sr);
+                sharedMap.put(connection, sr);
             }
             if (DEBUG) {
               System.err.println("!!! SharedContext: "+ctx+", pbuffer supported "+canCreateGLPbuffer+
@@ -199,6 +207,14 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
     return null;
   }
 
+  protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
+    SharedResource sr = getOrCreateShared(device);
+    if(null!=sr) {
+        return sr.getDevice();
+    }
+    return null;
+  }
+
   protected final void shutdownInstance() {
     if (DEBUG) {
         Exception e = new Exception("Debug");
@@ -238,38 +254,22 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
     return new WindowsOnscreenWGLDrawable(this, target);
   }
 
-  protected final GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) {
+  protected final GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) {
     if (target == null) {
       throw new IllegalArgumentException("Null target");
     }
-    return new WindowsOffscreenWGLDrawable(this, target);
-  }
-
-  public final boolean isReadDrawableAvailable(AbstractGraphicsDevice device) {
-    SharedResource sr = getOrCreateShared((null!=device)?device:defaultDevice);
-    if(null!=sr) {
-        return sr.isReadDrawableAvailable();
-    }
-    return false;
-  }
-
-  public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
-    SharedResource sr = getOrCreateShared((null!=device)?device:defaultDevice);
-    if(null!=sr) {
-        return sr.canCreateGLPbuffer();
+    AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+    GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+    if(!caps.isPBuffer()) {
+        return new WindowsBitmapWGLDrawable(this, target);
     }
-    return false;
-  }
 
-  protected final GLDrawableImpl createGLPbufferDrawableImpl(final NativeSurface target) {
-    if (target == null) {
-      throw new IllegalArgumentException("Null target");
-    }
-    final AbstractGraphicsDevice device = target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice();
+    // PBuffer GLDrawable Creation
+    final AbstractGraphicsDevice device = config.getScreen().getDevice();
 
     final SharedResource sr = getOrCreateShared(device);
     if(null==sr) {
-        return null;
+        throw new IllegalArgumentException("No shared resource for "+device);
     }
     final List returnList = new ArrayList();
     Runnable r = new Runnable() {
@@ -298,7 +298,27 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
     return (GLDrawableImpl) returnList.get(0);
   }
 
-  protected final NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
+  /**
+   * @return 1 if read drawable extension is available, 0 if not
+   *           and -1 if undefined yet, ie no shared device exist at this point.
+   */
+  public final int isReadDrawableAvailable(AbstractGraphicsDevice device) {
+    SharedResource sr = getOrCreateShared((null!=device)?device:defaultDevice);
+    if(null!=sr) {
+        return sr.isReadDrawableAvailable() ? 1 : 0 ;
+    }
+    return -1; // undefined
+  }
+
+  public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
+    SharedResource sr = getOrCreateShared((null!=device)?device:defaultDevice);
+    if(null!=sr) {
+        return sr.canCreateGLPbuffer();
+    }
+    return false;
+  }
+
+  protected final NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device,GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
     AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
     ProxySurface ns = new ProxySurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
                                      capsChosen, capsRequested, chooser, screen) );
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index c8b656e9f..3abbcee57 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -207,7 +207,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
       private final SharedResource createSharedResource(String connection) {
           X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.createDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT);
           sharedDevice.setCloseDisplay(true);
-          X11Util.lockDefaultToolkit(sharedDevice.getHandle()); // OK
+          sharedDevice.lock();
           try {
               String glXVendorName = GLXUtil.getVendorName(sharedDevice.getHandle());
               X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, 0);
@@ -245,7 +245,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
               }
               return new SharedResource(sharedDevice, sharedScreen, sharedDrawable, sharedContext, glXVersion, glXVendorName);
           } finally {
-              X11Util.unlockDefaultToolkit(sharedDevice.getHandle()); // OK
+              sharedDevice.unlock();
           }
       }
 
@@ -343,23 +343,18 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
       }
   }
 
-  protected final SharedResource getOrCreateShared(AbstractGraphicsDevice device) {
+  private SharedResource getOrCreateShared(AbstractGraphicsDevice device) {
     String connection = device.getConnection();
-    boolean deviceTried = getDeviceTried(connection);
     SharedResource sr;
     synchronized(sharedMap) {
       sr = (SharedResource) sharedMap.get(connection);
     }
 
-    if (DEBUG) {
-      System.err.println("getOrCreateShared() "+connection+": has shared "+(null!=sr)+", already tried "+deviceTried);
-    }
-
-    if(null==sr && !deviceTried) {
+    if(null==sr && !getDeviceTried(connection)) {
+        addDeviceTried(connection);
         if (DEBUG) {
           System.err.println("getOrCreateShared() "+connection+": trying");
         }
-        addDeviceTried(connection);
         sharedResourcesRunner.initializeAndWait(connection);
         synchronized(sharedMap) {
             sr = (SharedResource) sharedMap.get(connection);
@@ -380,6 +375,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
     return null;
   }
 
+  protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
+    SharedResource sr = getOrCreateShared(device);
+    if(null!=sr) {
+        return sr.getDevice();
+    }
+    return null;
+  }
+
   protected final long getOrCreateSharedDpy(AbstractGraphicsDevice device) {
     SharedResource sr = getOrCreateShared(device);
     if(null!=sr) {
@@ -439,35 +442,17 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
     if (target == null) {
       throw new IllegalArgumentException("Null target");
     }
-    return new X11OffscreenGLXDrawable(this, target);
-  }
-
-  public final boolean glXVersionGreaterEqualOneThree(AbstractGraphicsDevice device) {
-      VersionNumber glXVersion = getGLXVersion(device);
-      return ( null != glXVersion ) ? glXVersion.compareTo(versionOneThree) >= 0 : false ;
-  }
-
-  public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
-      if(null == device) {
-        SharedResource sr = getOrCreateShared(defaultDevice);
-        if(null!=sr) {
-            device = sr.getDevice();
-        }
-      }
-      return glXVersionGreaterEqualOneThree(device);
-  }
-
-  protected final GLDrawableImpl createGLPbufferDrawableImpl(final NativeSurface target) {
-    if (target == null) {
-      throw new IllegalArgumentException("Null target");
+    AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+    GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+    if(!caps.isPBuffer()) {
+        return new X11PixmapGLXDrawable(this, target);
     }
 
+    // PBuffer GLDrawable Creation
     GLDrawableImpl pbufferDrawable;
-
-    AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration();
     AbstractGraphicsDevice device = config.getScreen().getDevice();
 
-    /** 
+    /**
      * Due to the ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277,
      * we need to have a context current on the same Display to create a PBuffer.
      * The dummy context shall also use the same Display,
@@ -489,11 +474,27 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
     return pbufferDrawable;
   }
 
+  public final boolean glXVersionGreaterEqualOneThree(AbstractGraphicsDevice device) {
+      VersionNumber glXVersion = getGLXVersion(device);
+      return ( null != glXVersion ) ? glXVersion.compareTo(versionOneThree) >= 0 : false ;
+  }
 
-  protected final NativeSurface createOffscreenSurfaceImpl(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser,
+  public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
+      if(null == device) {
+        SharedResource sr = getOrCreateShared(defaultDevice);
+        if(null!=sr) {
+            device = sr.getDevice();
+        }
+      }
+      return glXVersionGreaterEqualOneThree(device);
+  }
+
+  protected final NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device,
+                                                           GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
+                                                           GLCapabilitiesChooser chooser,
                                                            int width, int height) {
     X11GraphicsScreen screen = null;
-    SharedResource sr = getOrCreateShared(defaultDevice);
+    SharedResource sr = getOrCreateShared(device);
     if(null!=sr) {
         screen = sr.getScreen();
     }
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index fcd2e4266..327ecd0be 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -88,56 +88,6 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
                                                  (GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen);
     }
 
-    /**
-    static X11GLXGraphicsConfiguration createDefaultGraphicsConfigurationFBConfig(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
-      if (absScreen == null) {
-        throw new IllegalArgumentException("AbstractGraphicsScreen is null");
-      }
-      if (!(absScreen instanceof X11GraphicsScreen)) {
-        throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here");
-      }
-      X11GraphicsScreen x11Screen = (X11GraphicsScreen)absScreen;
-
-      GLProfile glProfile = GLProfile.getDefault();
-      GLCapabilities availableCaps=null;
-      XVisualInfo xvis=null;
-      long fbcfg = 0;
-      int fbid = -1;
-
-      // Utilizing FBConfig
-      //
-      GLCapabilities capsFB = null;
-      long display = x11Screen.getDevice().getHandle();
-
-      try {
-          int screen = x11Screen.getIndex();
-          boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display);
-
-          long visID = X11Util.DefaultVisualID(display, x11Screen.getIndex());
-          xvis = X11GLXGraphicsConfiguration.XVisualID2XVisualInfo(display, visID);
-          availableCaps = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(glProfile, display, xvis, onscreen, usePBuffer, isMultisampleAvailable);
-
-          int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(availableCaps, true, isMultisampleAvailable, display, screen);
-          int[] count = { -1 };
-          PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, 0, count, 0);
-          if (fbcfgsL == null || fbcfgsL.limit()<1) {
-              throw new Exception("Could not fetch FBConfig for "+availableCaps);
-          }
-          fbcfg = fbcfgsL.get(0);
-          capsFB = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(glProfile, display, fbcfg, true, onscreen, usePBuffer, isMultisampleAvailable);
-
-          fbid = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfg);
-
-          xvis = GLX.glXGetVisualFromFBConfig(display, fbcfg);
-          if (xvis==null) {
-            throw new GLException("Error: Choosen FBConfig has no visual");
-          }
-      } catch (Throwable t) {
-      }
-
-      return new X11GLXGraphicsConfiguration(x11Screen, (null!=capsFB)?capsFB:availableCaps, availableCaps, null, xvis, fbcfg, fbid);
-    } */
-
     static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen,
                                                                          GLCapabilitiesImmutable capsReq,
                                                                          GLCapabilitiesChooser chooser,
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
deleted file mode 100644
index 5ae641278..000000000
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright (c) 2010 JogAmp Community. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * 
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.opengl.impl.x11.glx;
-
-import javax.media.opengl.*;
-
-public class X11OffscreenGLXContext extends X11GLXContext {
-
-  public X11OffscreenGLXContext(X11OffscreenGLXDrawable drawable,
-                               GLContext shareWith) {
-    super(drawable, shareWith);
-  }
-
-  public int getOffscreenContextPixelDataType() {
-    GL gl = getGL();
-    return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
-  }
-  
-  public int getOffscreenContextReadBuffer() {
-    GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
-    if (caps.getDoubleBuffered()) {
-      return GL.GL_BACK;
-    }
-    return GL.GL_FRONT;
-  }
-
-  public boolean offscreenImageNeedsVerticalFlip() {
-    // There doesn't seem to be a way to do this in the construction
-    // of the Pixmap or GLXPixmap
-    return true;
-  }
-}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
deleted file mode 100644
index f46bdbb75..000000000
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright (c) 2010 JogAmp Community. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * - Redistribution of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- * - Redistribution in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * 
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * 
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * 
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- * 
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.opengl.impl.x11.glx;
-
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.jogamp.nativewindow.impl.x11.*;
-
-public class X11OffscreenGLXDrawable extends X11GLXDrawable {
-  private long pixmap;
-
-  protected X11OffscreenGLXDrawable(GLDrawableFactory factory, NativeSurface target) {
-    super(factory, target, true);
-    create();
-  }
-
-  protected void setRealizedImpl() {
-    if(realized) {
-        create();
-    } else {
-        destroyImpl();
-    }
-  }
-
-  public GLContext createContext(GLContext shareWith) {
-    return new X11OffscreenGLXContext(this, shareWith);
-  }
-  
-  private void create() {
-    NativeSurface ns = getNativeSurface();
-    X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
-    XVisualInfo vis = config.getXVisualInfo();
-    int bitsPerPixel = vis.getDepth();
-    AbstractGraphicsScreen aScreen = config.getScreen();
-    AbstractGraphicsDevice aDevice = aScreen.getDevice();
-    long dpy = aDevice.getHandle();
-    int screen = aScreen.getIndex();
-
-    pixmap = X11Util.XCreatePixmap(dpy, X11Util.RootWindow(dpy, screen),
-                                  surface.getWidth(), surface.getHeight(), bitsPerPixel);
-    if (pixmap == 0) {
-        throw new GLException("XCreatePixmap failed");
-    }
-    long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap);
-    if (drawable == 0) {
-        X11Util.XFreePixmap(dpy, pixmap);
-        pixmap = 0;
-        throw new GLException("glXCreateGLXPixmap failed");
-    }
-    ((SurfaceChangeable)ns).setSurfaceHandle(drawable);
-    if (DEBUG) {
-        System.err.println("Created pixmap " + toHexString(pixmap) +
-                           ", GLXPixmap " + toHexString(drawable) +
-                           ", display " + toHexString(dpy));
-    }
-  }
-
-  protected void destroyImpl() {
-    if (pixmap == 0) return;
-
-    NativeSurface ns = getNativeSurface();
-    long display = ns.getDisplayHandle();
-
-    long drawable = ns.getSurfaceHandle();
-    if (DEBUG) {
-        System.err.println("Destroying pixmap " + toHexString(pixmap) +
-                           ", GLXPixmap " + toHexString(drawable) +
-                           ", display " + toHexString(display));
-    }
-
-    // Must destroy pixmap and GLXPixmap
-
-    if (DEBUG) {
-        long cur = GLX.glXGetCurrentContext();
-        if (cur != 0) {
-          System.err.println("WARNING: found context " + toHexString(cur) + " current during pixmap destruction");
-        }
-    }
-
-    // FIXME: workaround for crashes on NVidia hardware when
-    // destroying pixmap (no context is current at the point of the
-    // crash, at least from the point of view of
-    // glXGetCurrentContext)
-    GLX.glXMakeCurrent(display, 0, 0);
-
-    GLX.glXDestroyGLXPixmap(display, drawable);
-    X11Util.XFreePixmap(display, pixmap);
-    drawable = 0;
-    pixmap = 0;
-    ((SurfaceChangeable)ns).setSurfaceHandle(0);
-    display = 0;
-  }
-
-  protected void swapBuffersImpl() {
-    if(DEBUG) {
-        System.err.println("unhandled swapBuffersImpl() called for: "+this);
-    }
-  }
-}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PixmapGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PixmapGLXContext.java
new file mode 100644
index 000000000..b7b4da75d
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PixmapGLXContext.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * 
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.opengl.impl.x11.glx;
+
+import javax.media.opengl.*;
+
+public class X11PixmapGLXContext extends X11GLXContext {
+
+  public X11PixmapGLXContext(X11PixmapGLXDrawable drawable,
+                               GLContext shareWith) {
+    super(drawable, shareWith);
+  }
+
+  public int getOffscreenContextPixelDataType() {
+    GL gl = getGL();
+    return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
+  }
+  
+  public int getOffscreenContextReadBuffer() {
+    GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+    if (caps.getDoubleBuffered()) {
+      return GL.GL_BACK;
+    }
+    return GL.GL_FRONT;
+  }
+
+  public boolean offscreenImageNeedsVerticalFlip() {
+    // There doesn't seem to be a way to do this in the construction
+    // of the Pixmap or GLXPixmap
+    return true;
+  }
+}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PixmapGLXDrawable.java
new file mode 100644
index 000000000..0343ffb02
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PixmapGLXDrawable.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * - Redistribution of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ * - Redistribution in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * 
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ * 
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.opengl.impl.x11.glx;
+
+import javax.media.nativewindow.*;
+import javax.media.opengl.*;
+import com.jogamp.nativewindow.impl.x11.*;
+
+public class X11PixmapGLXDrawable extends X11GLXDrawable {
+  private long pixmap;
+
+  protected X11PixmapGLXDrawable(GLDrawableFactory factory, NativeSurface target) {
+    super(factory, target, true);
+    create();
+  }
+
+  protected void setRealizedImpl() {
+    if(realized) {
+        create();
+    } else {
+        destroyImpl();
+    }
+  }
+
+  public GLContext createContext(GLContext shareWith) {
+    return new X11PixmapGLXContext(this, shareWith);
+  }
+  
+  private void create() {
+    NativeSurface ns = getNativeSurface();
+    X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+    XVisualInfo vis = config.getXVisualInfo();
+    int bitsPerPixel = vis.getDepth();
+    AbstractGraphicsScreen aScreen = config.getScreen();
+    AbstractGraphicsDevice aDevice = aScreen.getDevice();
+    long dpy = aDevice.getHandle();
+    int screen = aScreen.getIndex();
+
+    pixmap = X11Util.XCreatePixmap(dpy, X11Util.RootWindow(dpy, screen),
+                                  surface.getWidth(), surface.getHeight(), bitsPerPixel);
+    if (pixmap == 0) {
+        throw new GLException("XCreatePixmap failed");
+    }
+    long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap);
+    if (drawable == 0) {
+        X11Util.XFreePixmap(dpy, pixmap);
+        pixmap = 0;
+        throw new GLException("glXCreateGLXPixmap failed");
+    }
+    ((SurfaceChangeable)ns).setSurfaceHandle(drawable);
+    if (DEBUG) {
+        System.err.println("Created pixmap " + toHexString(pixmap) +
+                           ", GLXPixmap " + toHexString(drawable) +
+                           ", display " + toHexString(dpy));
+    }
+  }
+
+  protected void destroyImpl() {
+    if (pixmap == 0) return;
+
+    NativeSurface ns = getNativeSurface();
+    long display = ns.getDisplayHandle();
+
+    long drawable = ns.getSurfaceHandle();
+    if (DEBUG) {
+        System.err.println("Destroying pixmap " + toHexString(pixmap) +
+                           ", GLXPixmap " + toHexString(drawable) +
+                           ", display " + toHexString(display));
+    }
+
+    // Must destroy pixmap and GLXPixmap
+
+    if (DEBUG) {
+        long cur = GLX.glXGetCurrentContext();
+        if (cur != 0) {
+          System.err.println("WARNING: found context " + toHexString(cur) + " current during pixmap destruction");
+        }
+    }
+
+    // FIXME: workaround for crashes on NVidia hardware when
+    // destroying pixmap (no context is current at the point of the
+    // crash, at least from the point of view of
+    // glXGetCurrentContext)
+    GLX.glXMakeCurrent(display, 0, 0);
+
+    GLX.glXDestroyGLXPixmap(display, drawable);
+    X11Util.XFreePixmap(display, pixmap);
+    drawable = 0;
+    pixmap = 0;
+    ((SurfaceChangeable)ns).setSurfaceHandle(0);
+    display = 0;
+  }
+
+  protected void swapBuffersImpl() {
+    if(DEBUG) {
+        System.err.println("unhandled swapBuffersImpl() called for: "+this);
+    }
+  }
+}
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index fd6aa7859..f9591e84d 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -224,13 +224,15 @@ public abstract class GLDrawableFactory {
   protected abstract void shutdownInstance();
 
   /**
-   * Retrieve the default <code>device</code> {@link AbstractGraphicsDevice#getConnection()}. for this factory<br>
-   * The implementation must return a non <code>null</code> default device, which must not be opened, ie. it's native handle may be <code>null</code>.
+   * Retrieve the default <code>device</code> {@link AbstractGraphicsDevice#getConnection() connection},
+   * {@link AbstractGraphicsDevice#getUnitID() unit ID} and {@link AbstractGraphicsDevice#getUniqueID() unique ID name}. for this factory<br>
+   * The implementation must return a non <code>null</code> default device, which must not be opened, ie. it's native handle is <code>null</code>.
    * @return the default shared device for this factory, eg. :0.0 on X11 desktop.
    */
   public abstract AbstractGraphicsDevice getDefaultDevice();
 
   /**
+   * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
    * @return true if the device is compatible with this factory, ie. if it can be used for creation. Otherwise false.
    */
   public abstract boolean getIsDeviceCompatible(AbstractGraphicsDevice device);
@@ -240,7 +242,7 @@ public abstract class GLDrawableFactory {
    * or if a new shared context could be created and mapped. Otherwise return false.<br>
    * Creation of the shared context is tried only once.
    *
-   * @param device if <code>null</code>, the platform default device is being used
+   * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
    */
   public final boolean getIsSharedContextAvailable(AbstractGraphicsDevice device) {
       return null != getOrCreateSharedContext(device);
@@ -251,7 +253,7 @@ public abstract class GLDrawableFactory {
    * either a preexisting or newly created, or <code>null</code> if creation failed or not supported.<br>
    * Creation of the shared context is tried only once.
    *
-   * @param device if <code>null</code>, the platform default device is being used
+   * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
    */
   protected final GLContext getOrCreateSharedContext(AbstractGraphicsDevice device) {
       if(null==device) {
@@ -306,12 +308,12 @@ public abstract class GLDrawableFactory {
    * The native platform's chosen Capabilties are referenced within the target
    * NativeSurface's AbstractGraphicsConfiguration.<p>
    *
-   * In case {@link javax.media.nativewindow.Capabilities#isOnscreen()} is true,<br>
+   * In case target's {@link javax.media.nativewindow.Capabilities#isOnscreen()} is true,<br>
    * an onscreen GLDrawable will be realized.
    * <p>
-   * In case {@link javax.media.nativewindow.Capabilities#isOnscreen()} is false,<br>
-   * either a Pbuffer drawable is created if {@link javax.media.opengl.GLCapabilities#isPBuffer()} is true,<br>
-   * or a simple offscreen drawable is creates. The latter is unlikely to be hardware accelerated.<br>
+   * In case target's {@link javax.media.nativewindow.Capabilities#isOnscreen()} is false,<br>
+   * either a Pbuffer drawable is created if target's {@link javax.media.opengl.GLCapabilities#isPBuffer()} is true,<br>
+   * or a simple pixmap/bitmap drawable is created. The latter is unlikely to be hardware accelerated.<br>
    * <p>
    *
    * @throws IllegalArgumentException if the passed target is null
@@ -324,34 +326,58 @@ public abstract class GLDrawableFactory {
     throws IllegalArgumentException, GLException;
 
   /**
-   * Creates a Offscreen GLDrawable with the given capabilites and dimensions. <P>
+   * Creates a Offscreen GLDrawable incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
+   * <p>
+   * A Pbuffer drawable/surface is created if both {@link javax.media.opengl.GLCapabilities#isPBuffer() caps.isPBuffer()}
+   * and {@link #canCreateGLPbuffer(javax.media.nativewindow.AbstractGraphicsDevice) canCreateGLPbuffer(device)} is true.<br>
+   * Otherwise a simple pixmap/bitmap drawable/surface is created, which is unlikely to be hardware accelerated.<br>
+   * </p>
+   *
+   * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
+   * @param caps the requested GLCapabilties
+   * @param chooser the custom chooser, may be null for default
+   * @param width the requested offscreen width
+   * @param height the requested offscreen height
+   *
+   * @return the created offscreen GLDrawable
    *
    * @throws GLException if any window system-specific errors caused
    *         the creation of the Offscreen to fail.
    */
-  public abstract GLDrawable createOffscreenDrawable(GLCapabilitiesImmutable capabilities,
+  public abstract GLDrawable createOffscreenDrawable(AbstractGraphicsDevice device,
+                                                     GLCapabilitiesImmutable capabilities,
                                                      GLCapabilitiesChooser chooser,
                                                      int width, int height)
     throws GLException;
 
   /**
-   * Returns true if it is possible to create a GLPbuffer. Some older
-   * graphics cards do not have this capability.
-   * @param passing the device for the query, may be null
+   * Creates an offscreen NativeSurface.<br>
+   * A Pbuffer surface is created if both {@link javax.media.opengl.GLCapabilities#isPBuffer() caps.isPBuffer()}
+   * and {@link #canCreateGLPbuffer(javax.media.nativewindow.AbstractGraphicsDevice) canCreateGLPbuffer(device)} is true.<br>
+   * Otherwise a simple pixmap/bitmap surface is created. The latter is unlikely to be hardware accelerated.<br>
+   *
+   * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
+   * @param caps the requested GLCapabilties
+   * @param chooser the custom chooser, may be null for default
+   * @param width the requested offscreen width
+   * @param height the requested offscreen height
+   * @return the created offscreen native surface
+   *
+   * @throws GLException if any window system-specific errors caused
+   *         the creation of the GLDrawable to fail.
    */
-  public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device);
+  public abstract NativeSurface createOffscreenSurface(AbstractGraphicsDevice device,
+                                                       GLCapabilitiesImmutable caps,
+                                                       GLCapabilitiesChooser chooser,
+                                                       int width, int height);
 
   /**
-   * Creates a Pbuffer GLDrawable with the given capabilites and dimensions. <P>
+   * Returns true if it is possible to create a GLPbuffer. Some older
+   * graphics cards do not have this capability.
    *
-   * @throws GLException if any window system-specific errors caused
-   *         the creation of the GLPbuffer to fail.
+   * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
    */
-  public abstract GLDrawable createGLPbufferDrawable(GLCapabilitiesImmutable capabilities,
-                                                     GLCapabilitiesChooser chooser,
-                                                     int initialWidth,
-                                                     int initialHeight)
-    throws GLException;
+  public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device);
 
   /**
    * Creates a GLPbuffer with the given capabilites and dimensions. <P>
@@ -359,10 +385,20 @@ public abstract class GLDrawableFactory {
    * See the note in the overview documentation on
    * <a href="../../../overview-summary.html#SHARING">context sharing</a>.
    *
+   * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
+   * @param capabilities the requested capabilities
+   * @param chooser the custom chooser, may be null for default
+   * @param initialWidth initial width of pbuffer
+   * @param initialHeight initial height of pbuffer
+   * @param shareWith a shared GLContext this GLPbuffer shall use
+   *
+   * @return the new {@link GLPbuffer} specific {@link GLAutoDrawable}
+   *
    * @throws GLException if any window system-specific errors caused
    *         the creation of the GLPbuffer to fail.
    */
-  public abstract GLPbuffer createGLPbuffer(GLCapabilitiesImmutable capabilities,
+  public abstract GLPbuffer createGLPbuffer(AbstractGraphicsDevice device,
+                                            GLCapabilitiesImmutable capabilities,
                                             GLCapabilitiesChooser chooser,
                                             int initialWidth,
                                             int initialHeight,
@@ -400,7 +436,8 @@ public abstract class GLDrawableFactory {
   /**
    * Returns true if it is possible to create an external GLDrawable
    * object via {@link #createExternalGLDrawable}.
-   * @param passing the device for the query, may be null
+   *
+   * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
    */
   public abstract boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device);
 
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 5c6be8bc4..c8bfe94d8 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -966,6 +966,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
     public void initialize() {
       // Fall-through path: create an offscreen context instead
       offscreenDrawable = (GLDrawableImpl) factory.createOffscreenDrawable(
+                                                null /* default platform device */,
                                                 offscreenCaps,
                                                 chooser,
                                                 Math.max(1, panelWidth),
@@ -1051,7 +1052,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
         throw new InternalError("Creating pbuffer twice without destroying it (memory leak / correctness bug)");
       }
       try {
-        pbuffer = factory.createGLPbuffer(offscreenCaps,
+        pbuffer = factory.createGLPbuffer(null /* default platform device */,
+                                          offscreenCaps,
                                           null,
                                           pbufferWidth,
                                           pbufferHeight,
-- 
cgit v1.2.3