aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/x11/glx
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-04-20 11:46:26 +0200
committerSven Gothel <[email protected]>2010-04-20 11:46:26 +0200
commit32790c376583beccd030eecd7c56cbe66d380172 (patch)
tree894613c7fc6a598aed59db87e5812ef6a44b83dd /src/jogl/classes/com/jogamp/opengl/impl/x11/glx
parentaa7084700bbf74d8bcc98cf0239f57cff2983423 (diff)
JOGL GL4 preperation (cont):
- All available OpenGL versions (native/platform) are verified at GLProfile initialization and can be queried .. A mapping of major,compat -> major,minor,options is created. - Removal of temp context creation, when creating a context. This was necessary to query general availability of ARB_create_context. Due to the shared context of X11GLXDrawableFactory and WindowsWGLDrawableFactory, this is no more necessary. Due to the version mapping, the ARB_create_context paramters are known. - NativeWindow X11Lib: Added X11ErrorHandler, throwing a RuntimeException. Necessary to catch BadMatch .. etc X11 errors, eg for glXCreateContextAttribsARB Hence all X11 calls are covered now. - X11DummyGLXDrawable needs to use an own Window, otherwise GLn n>2 fails - Flattening the desktop GL* implementation, all use GL4bcImpl, which reduces the footprint dramatically. - GL*Impl.isGL*() (desktop) utilizes the GLContext.isGL*(), hence the results reflect the actual native context version. - GLContextImpl makeCurrent/create: Added workflow documentation, clarified code, defined abstract methods to have a protocol. - Removed moved files (from here to gluegen), see gluegen a01cb3d59715a41153380f1977ec75263b762dc6 - NativeLibLoader -> <TYPE>JNILibLoader - Fixed Exception Handling (as in gluegen bce53b52c8638729750c4286dbc04cb14329fd34), ie removed empty catch Throwable .. - GLContext.setSwapInterval(): Nop in offscreen case, otherwise X11IOError (NVIDIA Bug) Test: Tests - Junit - demos.gears.Gears - demos.jrefract.JRefract Platforms - Linux 64/32 ATI/NVidia - MacOsX - Windows (virtualbox 3.1.6, offscreen failed) TODO/BUGS: - FIXME ATI GLn n>2 with AWT, can't make context current, works well on NVIDIA though - FIXME GL3GL4: Due to GL3 and GL4 implementation bugs, we still choose GL2 first, if available! - Add GL 3.3 to GL3/gl3ext.h - Add GL 4.0 to GL3/gl3ext.h and fix the GL3/GL4 seperation - Rename jogl.gl2.jar -> jogl.gldesktop.jar (as done with it's native lib already)
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/x11/glx')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java13
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java121
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java52
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java29
5 files changed, 101 insertions, 116 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
index a865e91e8..1f148bead 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
@@ -42,7 +42,7 @@ import com.jogamp.nativewindow.impl.x11.*;
public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
- // private long dummyWindow = 0;
+ private long dummyWindow = 0;
/**
* Due to the ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277,
@@ -62,17 +62,15 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
X11GraphicsDevice device = (X11GraphicsDevice) screen.getDevice();
long dpy = device.getHandle();
int scrn = screen.getIndex();
- // long visualID = config.getVisualID();
- // System.out.println("X11DummyGLXDrawable: dpy "+toHexString(dpy)+", scrn "+scrn+", visualID "+toHexString(visualID));
+ long visualID = config.getVisualID();
X11Lib.XLockDisplay(dpy);
try{
- nw.setSurfaceHandle( X11Lib.RootWindow(dpy, scrn) );
- // dummyWindow = X11Lib.CreateDummyWindow(dpy, scrn, visualID);
- // nw.setSurfaceHandle( dummyWindow );
+ dummyWindow = X11Lib.CreateDummyWindow(dpy, scrn, visualID);
} finally {
X11Lib.XUnlockDisplay(dpy);
}
+ nw.setSurfaceHandle( dummyWindow );
}
public void setSize(int width, int height) {
@@ -87,11 +85,10 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
}
public void destroy() {
- /**
if(0!=dummyWindow) {
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
long dpy = config.getScreen().getDevice().getHandle();
X11Lib.DestroyDummyWindow(dpy, dummyWindow);
- } */
+ }
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java
index b8f25aad7..139c0deed 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java
@@ -55,7 +55,7 @@ public class X11ExternalGLXContext extends X11GLXContext {
super(drawable, null);
this.context = context;
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, 0);
+ setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
index f5e291c5f..7d907bf28 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
@@ -103,12 +103,31 @@ public abstract class X11GLXContext extends GLContextImpl {
protected Map/*<String, String>*/ getExtensionNameMap() { return extensionNameMap; }
- /** Helper routine which usually just turns around and calls
- * createContext (except for pbuffers, which use a different context
- * creation mechanism). Should only be called by {@link
- * makeCurrentImpl()}.
- */
- protected abstract void create();
+ protected boolean glXMakeContextCurrent(long dpy, long writeDrawable, long readDrawable, long ctx) {
+ boolean res = false;
+
+ try {
+ res = GLX.glXMakeContextCurrent(dpy, writeDrawable, readDrawable, ctx);
+ } catch (RuntimeException re) {
+ if(DEBUG) {
+ System.err.println("X11GLXContext.glXMakeContextCurrent failed: "+re+", with "+
+ "dpy "+toHexString(dpy)+
+ ", write "+toHexString(writeDrawable)+
+ ", read "+toHexString(readDrawable)+
+ ", ctx "+toHexString(ctx));
+ re.printStackTrace();
+ }
+ }
+ return res;
+ }
+
+ protected void destroyContextARBImpl(long _context) {
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ long display = config.getScreen().getDevice().getHandle();
+
+ glXMakeContextCurrent(display, 0, 0, 0);
+ GLX.glXDestroyContext(display, _context);
+ }
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
X11GLXDrawableFactory factory = (X11GLXDrawableFactory)drawable.getFactoryImpl();
@@ -119,7 +138,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if(null==factory.getSharedContext()) {
glXExt = getGLXExt();
} else {
- glXExt = factory.getSharedContext().getGLXExt();
+ glXExt = ((X11GLXContext)factory.getSharedContext()).getGLXExt();
}
boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ;
@@ -156,20 +175,27 @@ public abstract class X11GLXContext extends GLContextImpl {
}
}
- _context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0);
+ try {
+ _context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0);
+ } catch (RuntimeException re) {
+ if(DEBUG) {
+ System.err.println("X11GLXContext.createContextARB glXCreateContextAttribsARB failed: "+re+", with "+getGLVersion(null, major, minor, ctp, "@creation"));
+ re.printStackTrace();
+ }
+ }
if(0==_context) {
if(DEBUG) {
System.err.println("X11GLXContext.createContextARB couldn't create "+getGLVersion(null, major, minor, ctp, "@creation"));
}
} else {
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- _context)) {
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ _context)) {
if(DEBUG) {
System.err.println("X11GLXContext.createContextARB couldn't make current "+getGLVersion(null, major, minor, ctp, "@creation"));
}
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
+ glXMakeContextCurrent(display, 0, 0, 0);
GLX.glXDestroyContext(display, _context);
_context = 0;
}
@@ -179,7 +205,7 @@ public abstract class X11GLXContext extends GLContextImpl {
/**
* Creates and initializes an appropriate OpenGL context. Should only be
- * called by {@link create()}.
+ * called by {@link #create()}.
* Note: The direct parameter may be overwritten by the direct state of a shared context.
*/
protected void createContext(boolean direct) {
@@ -213,13 +239,13 @@ public abstract class X11GLXContext extends GLContextImpl {
if (context == 0) {
throw new GLException("Unable to create context(0)");
}
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- context)) {
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ context)) {
throw new GLException("Error making temp context(0) current: display "+toHexString(display)+", context "+toHexString(context)+", drawable "+drawable);
}
- setGLFunctionAvailability(true, 0, 0, 0); // use GL_VERSION
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
return;
}
@@ -245,21 +271,21 @@ public abstract class X11GLXContext extends GLContextImpl {
if (temp_context == 0) {
throw new GLException("Unable to create temp OpenGL context(1)");
}
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- temp_context)) {
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ temp_context)) {
throw new GLException("Error making temp context(1) current: display "+toHexString(display)+", context "+toHexString(context)+", drawable "+drawable);
}
- setGLFunctionAvailability(true, 0, 0, 0); // use GL_VERSION
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
if( createContextARBTried ||
!isFunctionAvailable("glXCreateContextAttribsARB") ||
!isExtensionAvailable("GLX_ARB_create_context") ) {
if(glp.isGL3()) {
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
+ glXMakeContextCurrent(display, 0, 0, 0);
GLX.glXDestroyContext(display, temp_context);
- throw new GLException("Unable to create OpenGL >= 3.1 context (no GLX_ARB_create_context)");
+ throw new GLException("Unable to create OpenGL >= 3.1 context (failed GLX_ARB_create_context), GLProfile "+glp+", Drawable "+drawable);
}
// continue with temp context for GL < 3.0
@@ -271,22 +297,19 @@ public abstract class X11GLXContext extends GLContextImpl {
}
if(0!=context) {
- // need to update the GL func table ..
- setGLFunctionAvailability(true, major[0], minor[0], ctp[0]);
-
if(0!=temp_context) {
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
+ glXMakeContextCurrent(display, 0, 0, 0);
GLX.glXDestroyContext(display, temp_context);
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- context)) {
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ context)) {
throw new GLException("Cannot make previous verified context current");
}
}
} else {
if(!glp.isGL2()) {
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
+ glXMakeContextCurrent(display, 0, 0, 0);
GLX.glXDestroyContext(display, temp_context);
throw new GLException("X11GLXContext.createContext failed, but context > GL2 requested "+getGLVersion(null, major[0], minor[0], ctp[0], "@creation")+", ");
}
@@ -296,11 +319,11 @@ public abstract class X11GLXContext extends GLContextImpl {
// continue with temp context for GL <= 3.0
context = temp_context;
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- context)) {
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ context)) {
+ glXMakeContextCurrent(display, 0, 0, 0);
GLX.glXDestroyContext(display, temp_context);
throw new GLException("Error making context(1) current: display "+toHexString(display)+", context "+toHexString(context)+", drawable "+drawable);
}
@@ -349,19 +372,19 @@ public abstract class X11GLXContext extends GLContextImpl {
boolean created = false;
if (context == 0) {
create();
+ created = true;
GLContextShareSet.contextCreated(this);
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Created GL context for " + getClass().getName());
}
- created = true;
}
if (GLX.glXGetCurrentContext() != context) {
- if (!GLX.glXMakeContextCurrent(dpy,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- context)) {
+ if (!glXMakeContextCurrent(dpy,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ context)) {
throw new GLException("Error making context current: "+this);
}
if (DEBUG && (VERBOSE || created)) {
@@ -374,7 +397,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
if (created) {
- setGLFunctionAvailability(false, -1, -1, -1);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
return CONTEXT_CURRENT_NEW;
}
return CONTEXT_CURRENT;
@@ -386,7 +409,7 @@ public abstract class X11GLXContext extends GLContextImpl {
protected void releaseImplAfterLock() throws GLException {
getDrawableImpl().getFactoryImpl().lockToolkit();
try {
- if (!GLX.glXMakeContextCurrent(drawable.getNativeWindow().getDisplayHandle(), 0, 0, 0)) {
+ if (!glXMakeContextCurrent(drawable.getNativeWindow().getDisplayHandle(), 0, 0, 0)) {
throw new GLException("Error freeing OpenGL context");
}
} finally {
@@ -494,6 +517,10 @@ public abstract class X11GLXContext extends GLContextImpl {
private int hasSwapIntervalSGI = 0;
protected void setSwapIntervalImpl(int interval) {
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
+ if(!glCaps.isOnscreen()) return;
+
getDrawableImpl().getFactoryImpl().lockToolkit();
try {
GLXExt glXExt = getGLXExt();
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 0d74bb791..f331ad2a2 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
@@ -43,8 +43,9 @@ import javax.media.nativewindow.x11.*;
import javax.media.opengl.*;
import com.jogamp.gluegen.runtime.opengl.*;
import com.jogamp.opengl.impl.*;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.*;
import com.jogamp.nativewindow.impl.NullWindow;
-import com.jogamp.nativewindow.impl.NWReflection;
import com.jogamp.nativewindow.impl.x11.*;
public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements DynamicLookupHelper {
@@ -58,9 +59,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
// The act of constructing them causes them to be registered
new X11GLXGraphicsConfigurationFactory();
try {
- NWReflection.createInstance("com.jogamp.opengl.impl.x11.glx.awt.X11AWTGLXGraphicsConfigurationFactory",
+ ReflectionUtil.createInstance("com.jogamp.opengl.impl.x11.glx.awt.X11AWTGLXGraphicsConfigurationFactory",
new Object[] {});
- } catch (Throwable t) { }
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.createThreadLocalDisplay(null));
vendorName = GLXUtil.getVendorName(sharedDevice.getHandle());
@@ -70,9 +71,20 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
X11Util.markGlobalDisplayUndeletable(sharedDevice.getHandle()); // ATI hack ..
}
sharedScreen = new X11GraphicsScreen(sharedDevice, 0);
+ X11Lib.XLockDisplay(sharedScreen.getDevice().getHandle());
+ sharedDrawable = new X11DummyGLXDrawable(sharedScreen, this, null);
+ X11GLXContext ctx = (X11GLXContext) sharedDrawable.createContext(null);
+ ctx.makeCurrent();
+ ctx.release();
+ sharedContext = ctx;
+ X11Lib.XUnlockDisplay(sharedScreen.getDevice().getHandle());
+ if(null==sharedContext) {
+ throw new GLException("Couldn't init shared resources");
+ }
if (DEBUG) {
System.err.println("!!! Vendor: "+vendorName+", ATI: "+isVendorATI+", NV: "+isVendorNVIDIA);
System.err.println("!!! SharedScreen: "+sharedScreen);
+ System.err.println("!!! SharedContext: "+sharedContext);
}
}
@@ -88,30 +100,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
private X11DummyGLXDrawable sharedDrawable=null;
private X11GLXContext sharedContext=null;
- // package private ..
- final X11GLXContext getSharedContext() {
+ protected final GLDrawableImpl getSharedDrawable() {
validate();
- return sharedContext;
+ return sharedDrawable;
}
- private void initShared() {
- if(null==sharedDrawable) {
- X11Lib.XLockDisplay(sharedScreen.getDevice().getHandle());
- sharedDrawable = new X11DummyGLXDrawable(sharedScreen, this, null);
- X11GLXContext _sharedContext = (X11GLXContext) sharedDrawable.createContext(null);
- {
- _sharedContext.makeCurrent();
- _sharedContext.release();
- }
- sharedContext = _sharedContext;
- X11Lib.XUnlockDisplay(sharedScreen.getDevice().getHandle());
- if (DEBUG) {
- System.err.println("!!! SharedContext: "+sharedContext);
- }
- if(null==sharedContext) {
- throw new GLException("Couldn't init shared resources");
- }
- }
+ protected final GLContextImpl getSharedContext() {
+ validate();
+ return sharedContext;
}
public void shutdown() {
@@ -145,7 +141,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
if (target == null) {
throw new IllegalArgumentException("Null target");
}
- initShared();
if( isVendorATI() ) {
X11Util.markGlobalDisplayUndeletable(target.getDisplayHandle()); // ATI hack ..
}
@@ -157,11 +152,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
if (target == null) {
throw new IllegalArgumentException("Null target");
}
- initShared();
if( isVendorATI() ) {
X11Util.markGlobalDisplayUndeletable(target.getDisplayHandle()); // ATI hack ..
}
- initShared();
return new X11OffscreenGLXDrawable(this, target);
}
@@ -203,7 +196,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
if (target == null) {
throw new IllegalArgumentException("Null target");
}
- initShared();
GLDrawableImpl pbufferDrawable;
@@ -234,7 +226,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
validate();
- initShared();
X11Lib.XLockDisplay(sharedScreen.getDevice().getHandle());
NullWindow nw = new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, sharedScreen));
X11Lib.XUnlockDisplay(sharedScreen.getDevice().getHandle());
@@ -244,19 +235,16 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
public GLContext createExternalGLContext() {
validate();
- initShared();
return X11ExternalGLXContext.create(this, null);
}
public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
validate();
- initShared();
return canCreateGLPbuffer(device);
}
public GLDrawable createExternalGLDrawable() {
validate();
- initShared();
return X11ExternalGLXDrawable.create(this, null);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java
index e0993abc3..1b70adf6b 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java
@@ -68,33 +68,6 @@ public class X11PbufferGLXContext extends X11GLXContext {
}
protected void create() {
- if (DEBUG) {
- System.err.println("Creating context for pbuffer " + drawable.getWidth() +
- " x " + drawable.getHeight());
- }
-
- // Create a gl context for the p-buffer.
- X11GLXContext other = (X11GLXContext) GLContextShareSet.getShareContext(this);
- long share = 0;
- if (other != null) {
- share = other.getContext();
- if (share == 0) {
- throw new GLException("GLContextShareSet returned an invalid OpenGL context");
- }
- }
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)
- getGLDrawable().getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
-
- context = GLX.glXCreateNewContext(drawable.getNativeWindow().getDisplayHandle(),
- config.getFBConfig(), GLX.GLX_RGBA_TYPE, share, true);
- if (context == 0) {
- throw new GLException("pbuffer creation error: glXCreateNewContext() failed");
- }
- GLContextShareSet.contextCreated(this);
-
- if (DEBUG) {
- System.err.println("Created context for pbuffer " + drawable.getWidth() +
- " x " + drawable.getHeight());
- }
+ createContext(true);
}
}