aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build-common.xml8
-rw-r--r--make/build-jogl.xml2
-rw-r--r--make/build-junit.xml2
-rwxr-xr-xmake/config/nativewindow/x11-CustomCCode.c61
-rw-r--r--make/config/nativewindow/x11-CustomJavaCode.java5
-rw-r--r--make/config/nativewindow/x11-lib.cfg5
-rw-r--r--make/stub_includes/win32/wingdi.h2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java26
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java7
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java18
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java20
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java15
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java85
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java22
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java88
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java5
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java7
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java7
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java4
26 files changed, 317 insertions, 130 deletions
diff --git a/make/build-common.xml b/make/build-common.xml
index 10f37c3e4..d6c39c1ed 100644
--- a/make/build-common.xml
+++ b/make/build-common.xml
@@ -121,6 +121,8 @@
<property name="obj.gluegen" value="${build.gluegen}/obj"/>
<property name="gluegen.jar" value="${build.gluegen}/gluegen.jar" />
<property name="junit.jar" value="${gluegen.make}/lib/junit-4.5.jar" />
+ <property name="ant.jar" value="${ant.home}/lib/ant.jar" />
+ <property name="ant-junit.jar" value="${ant.home}/lib/ant-junit.jar" />
<property name="nativewindow.make" value="." />
<property name="nativewindow.build.xml" value="${nativewindow.make}/build-nativewindow.xml" />
@@ -179,6 +181,8 @@
<path id="junit_jogl_newt.compile.classpath">
<pathelement location="${junit.jar}" />
+ <pathelement location="${ant.jar}" />
+ <pathelement location="${ant-junit.jar}" />
<pathelement location="${gluegen-rt.jar}" />
<pathelement location="${nativewindow.all.jar}" />
<pathelement location="${jogl.all.jar}" />
@@ -187,6 +191,8 @@
<path id="junit_jogl_newt.run.classpath">
<pathelement location="${junit.jar}" />
+ <pathelement location="${ant.jar}" />
+ <pathelement location="${ant-junit.jar}" />
<pathelement location="${gluegen-rt.jar}" />
<pathelement location="${nativewindow.all.jar}" />
<pathelement location="${jogl.all.jar}" />
@@ -194,7 +200,7 @@
<pathelement location="${jogl.test.jar}" />
</path>
<property name="junit_jogl_newt.run.jars"
- value="${junit.jar}${path.separator}${gluegen-rt.jar}${path.separator}${nativewindow.all.jar}${path.separator}${jogl.all.jar}${path.separator}${newt.all.jar}${path.separator}${jogl.test.jar}"/>
+ value="${junit.jar}${path.separator}${ant.jar}${path.separator}${ant-junit.jar}${path.separator}${gluegen-rt.jar}${path.separator}${nativewindow.all.jar}${path.separator}${jogl.all.jar}${path.separator}${newt.all.jar}${path.separator}${jogl.test.jar}"/>
<!-- JavaSE combinations . NO.AWT -->
<property name="nativewindow.all-noawt.jar" value="${build.nativewindow}/nativewindow.all-noawt.jar" />
diff --git a/make/build-jogl.xml b/make/build-jogl.xml
index b1f0a02eb..93cf7bf6f 100644
--- a/make/build-jogl.xml
+++ b/make/build-jogl.xml
@@ -396,7 +396,7 @@
<and>
<isset property="java.generate.skip.es1"/>
<isset property="java.generate.skip.es2"/>
- <!--isset property="java.generate.skip.gl2"/-->
+ <isset property="java.generate.skip.gl2"/>
<isset property="java.generate.skip.glu"/>
</and>
</condition>
diff --git a/make/build-junit.xml b/make/build-junit.xml
index 58e8e3b7f..887060084 100644
--- a/make/build-junit.xml
+++ b/make/build-junit.xml
@@ -113,7 +113,7 @@
relative="true"
failonerror="false">
<env key="${system.env.library.path}" path="${obj.all.paths}"/>
- <env key="CLASSPATH" value="${ant.home}/lib/ant.jar${path.separator}${ant.home}/lib/ant-junit.jar${path.separator}${junit_jogl_newt.run.jars}"/>
+ <env key="CLASSPATH" value="${junit_jogl_newt.run.jars}"/>
<arg value="-Djava.library.path=${obj.all.paths}"/>
<arg line="${jvmarg.newt}"/>
<arg line="com.jogamp.newt.util.MainThread"/>
diff --git a/make/config/nativewindow/x11-CustomCCode.c b/make/config/nativewindow/x11-CustomCCode.c
index 8eded9aa2..982a39f7e 100755
--- a/make/config/nativewindow/x11-CustomCCode.c
+++ b/make/config/nativewindow/x11-CustomCCode.c
@@ -167,3 +167,64 @@ Java_com_jogamp_nativewindow_impl_x11_X11Lib_XGetVisualInfoCopied1__JJLjava_nio_
return jbyteCopy;
}
+
+static XIOErrorHandler origIOErrorHandler = NULL;
+
+static int displayIOErrorHandler(Display *dpy)
+{
+ fprintf(stderr, "Fatal: Nativewindow X11 IOError: Display %p not available\n", dpy);
+ origIOErrorHandler(dpy);
+ return 0;
+}
+
+static void displayIOErrorHandlerEnable(int onoff) {
+ if(onoff) {
+ if(NULL==origIOErrorHandler) {
+ origIOErrorHandler = XSetIOErrorHandler(displayIOErrorHandler);
+ }
+ } else {
+ XSetIOErrorHandler(origIOErrorHandler);
+ origIOErrorHandler = NULL;
+ }
+}
+
+/* Java->C glue code:
+ * Java package: com.jogamp.nativewindow.impl.x11.X11Lib
+ * Java method: int XCloseDisplay(long display)
+ * C function: int XCloseDisplay(Display * display);
+ */
+JNIEXPORT jint JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Lib_XCloseDisplay__J(JNIEnv *env, jclass _unused, jlong display) {
+ int _res;
+ // fprintf(stderr, "X11Lib.XCloseDisplay: %p\n", (Display *) (intptr_t) display);
+ displayIOErrorHandlerEnable(1);
+ _res = XCloseDisplay((Display *) (intptr_t) display);
+ displayIOErrorHandlerEnable(0);
+ return _res;
+}
+
+/* Java->C glue code:
+ * Java package: com.jogamp.nativewindow.impl.x11.X11Lib
+ * Java method: long XOpenDisplay(java.lang.String arg0)
+ * C function: Display * XOpenDisplay(const char * );
+ */
+JNIEXPORT jlong JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Lib_XOpenDisplay__Ljava_lang_String_2(JNIEnv *env, jclass _unused, jstring arg0) {
+ const char* _strchars_arg0 = NULL;
+ Display * _res;
+ if ( NULL != arg0 ) {
+ _strchars_arg0 = (*env)->GetStringUTFChars(env, arg0, (jboolean*)NULL);
+ if ( NULL == _strchars_arg0 ) {
+ (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"),
+ "Failed to get UTF-8 chars for argument \"arg0\" in native dispatcher for \"XOpenDisplay\"");
+ return 0;
+ }
+ }
+ _res = XOpenDisplay((char *) _strchars_arg0);
+ // fprintf(stderr, "X11Lib.XOpenDisplay: %s -> %p\n", _strchars_arg0, _res);
+ if ( NULL != arg0 ) {
+ (*env)->ReleaseStringUTFChars(env, arg0, _strchars_arg0);
+ }
+ return (jlong) (intptr_t) _res;
+}
+
diff --git a/make/config/nativewindow/x11-CustomJavaCode.java b/make/config/nativewindow/x11-CustomJavaCode.java
index 5c269c6c8..d631c92cb 100644
--- a/make/config/nativewindow/x11-CustomJavaCode.java
+++ b/make/config/nativewindow/x11-CustomJavaCode.java
@@ -24,3 +24,8 @@
/** Entry point to C language function: <code> XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); </code> */
private static native java.nio.ByteBuffer XGetVisualInfoCopied1(long arg0, long arg1, java.nio.ByteBuffer arg2, Object arg3, int arg3_byte_offset);
+ public static native long XOpenDisplay(String arg0);
+ public static native int XCloseDisplay(long display);
+ public static native long dlopen(String name);
+ public static native long dlsym(String name);
+
diff --git a/make/config/nativewindow/x11-lib.cfg b/make/config/nativewindow/x11-lib.cfg
index 7a64307da..394dd230a 100644
--- a/make/config/nativewindow/x11-lib.cfg
+++ b/make/config/nativewindow/x11-lib.cfg
@@ -20,8 +20,9 @@ Opaque long Display *
Opaque boolean Bool
Opaque long GLXFBConfig
-CustomJavaCode X11Lib public static native long dlopen(String name);
-CustomJavaCode X11Lib public static native long dlsym(String name);
+# Manually implement XOpenDisplay, XCloseDisplay, catching XIOError
+ManuallyImplement XCloseDisplay
+ManuallyImplement XOpenDisplay
IncludeAs CustomJavaCode X11Lib x11-CustomJavaCode.java
IncludeAs CustomCCode x11-CustomCCode.c
diff --git a/make/stub_includes/win32/wingdi.h b/make/stub_includes/win32/wingdi.h
index 46aeec2b6..fbf2ec5ec 100644
--- a/make/stub_includes/win32/wingdi.h
+++ b/make/stub_includes/win32/wingdi.h
@@ -212,7 +212,7 @@ WINGDIAPI HGDIOBJ WINAPI SelectObject(HDC, HGDIOBJ);
// Routines for creation of a dummy window, device context and OpenGL
// context for the purposes of getting wglChoosePixelFormatARB and
// associated routines
-HDC CreateDummyWindow(int,int,int,int);
+HWND CreateDummyWindow( int x, int y, int width, int height ) ;
WINUSERAPI BOOL WINAPI ShowWindow(HWND hWnd, int nCmdShow);
WINUSERAPI HDC WINAPI GetDC(HWND);
WINUSERAPI int WINAPI ReleaseDC(HWND hWnd, HDC hDC);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
index 893827a8c..7543a1084 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
@@ -41,6 +41,7 @@ package com.jogamp.opengl.impl;
import com.jogamp.common.os.DynamicLookupHelper;
import java.nio.*;
+import java.util.*;
import javax.media.opengl.*;
import com.jogamp.nativewindow.impl.NWReflection;
@@ -346,13 +347,30 @@ public abstract class GLContextImpl extends GLContext {
/** Maps the given "platform-independent" function name to a real function
name. Currently this is only used to map "glAllocateMemoryNV" and
associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV. */
- protected abstract String mapToRealGLFunctionName(String glFunctionName);
+ protected String mapToRealGLFunctionName(String glFunctionName) {
+ Map/*<String, String>*/ map = getFunctionNameMap();
+ String lookup = ( null != map ) ? (String) map.get(glFunctionName) : null;
+ if (lookup != null) {
+ return lookup;
+ }
+ return glFunctionName;
+ }
+ protected abstract Map/*<String, String>*/ getFunctionNameMap() ;
/** Maps the given "platform-independent" extension name to a real
function name. Currently this is only used to map
- "GL_ARB_pbuffer" and "GL_ARB_pixel_format" to "WGL_ARB_pbuffer"
- and "WGL_ARB_pixel_format" (not yet mapped to X11). */
- protected abstract String mapToRealGLExtensionName(String glExtensionName);
+ "GL_ARB_pbuffer" to "WGL_ARB_pbuffer/GLX_SGIX_pbuffer" and
+ "GL_ARB_pixel_format" to "WGL_ARB_pixel_format/n.a."
+ */
+ protected String mapToRealGLExtensionName(String glExtensionName) {
+ Map/*<String, String>*/ map = getExtensionNameMap();
+ String lookup = ( null != map ) ? (String) map.get(glExtensionName) : null;
+ if (lookup != null) {
+ return lookup;
+ }
+ return glExtensionName;
+ }
+ protected abstract Map/*<String, String>*/ getExtensionNameMap() ;
/** Helper routine which resets a ProcAddressTable generated by the
GLEmitter by looking up anew all of its function pointers. */
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
index c8faf0f65..35810678c 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
@@ -54,6 +54,9 @@ import java.lang.reflect.*;
public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
protected static final boolean DEBUG = Debug.debug("GLDrawableFactory");
+ public void shutdown() {
+ }
+
//---------------------------------------------------------------------------
// Dispatching GLDrawable construction in respect to the NativeWindow Capabilities
//
@@ -76,7 +79,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
if( ! ( target instanceof SurfaceChangeable ) ) {
throw new IllegalArgumentException("Passed NativeWindow must implement SurfaceChangeable for offscreen: "+target);
}
- if(caps.isPBuffer() && canCreateGLPbuffer()) {
+ if(caps.isPBuffer()) {
if(DEBUG) {
System.out.println("GLDrawableFactoryImpl.createGLDrawable -> PbufferDrawable: "+target);
}
@@ -111,7 +114,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
protected abstract GLDrawableImpl createGLPbufferDrawableImpl(NativeWindow target);
protected GLDrawableImpl createGLPbufferDrawable(NativeWindow target) {
- if (!canCreateGLPbuffer()) {
+ if (!canCreateGLPbuffer(target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice())) {
throw new GLException("Pbuffer support not available with current graphics card");
}
return createGLPbufferDrawableImpl(target);
@@ -215,7 +218,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
// implement this functionality on all other platforms
//
- public abstract boolean canCreateContextOnJava2DSurface();
+ public abstract boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device);
public abstract GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith)
throws GLException;
@@ -312,7 +315,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
throw new IllegalArgumentException("Should not call this unless setDisplayGamma called first");
}
resetGammaRamp(originalGammaRamp);
- unregisterGammeShutdownHook();
+ unregisterGammaShutdownHook();
}
//------------------------------------------------------
@@ -364,7 +367,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
gammaShutdownHookRegistered = true;
}
- private synchronized void unregisterGammeShutdownHook() {
+ private synchronized void unregisterGammaShutdownHook() {
if (!gammaShutdownHookRegistered)
return;
if (gammaShutdownHook == null) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
index 10c70db99..04114a445 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
@@ -153,11 +153,9 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
public String toString() {
- return getClass().getName()+"[realized "+getRealized()+
- ",\n\tfactory "+getFactory()+
- ",\n\twindow "+getNativeWindow()+
- ",\n\trequested "+getRequestedGLCapabilities()+
- ",\n\tchosen "+getChosenGLCapabilities()+"]";
+ return getClass().getName()+"[Realized "+getRealized()+
+ ",\n\tFactory "+getFactory()+
+ ",\n\tWindow "+getNativeWindow()+"]";
}
protected GLDrawableFactory factory;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
index ec2677559..a96736c00 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
@@ -80,13 +80,9 @@ public abstract class EGLContext extends GLContextImpl {
return eglExtProcAddressTable;
}
- protected String mapToRealGLFunctionName(String glFunctionName) {
- return glFunctionName;
- }
+ protected Map/*<String, String>*/ getFunctionNameMap() { return null; }
- protected String mapToRealGLExtensionName(String glExtensionName) {
- return glExtensionName;
- }
+ protected Map/*<String, String>*/ getExtensionNameMap() { return null; }
public long getContext() {
return eglContext;
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 34b039b3a..5a193b2ff 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
@@ -70,7 +70,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
throw new GLException("Not yet implemented");
}
- public boolean canCreateGLPbuffer() {
+ public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
return true;
}
@@ -89,7 +89,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return new EGLExternalContext(absScreen);
}
- public boolean canCreateExternalGLDrawable() {
+ public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
return false;
}
@@ -100,7 +100,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
public void loadGLULibrary() {
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
index bf4023c1c..d3a634792 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
@@ -84,16 +84,10 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return cglExtProcAddressTable;
}
- protected String mapToRealGLFunctionName(String glFunctionName)
- {
- return glFunctionName;
- }
-
- protected String mapToRealGLExtensionName(String glExtensionName)
- {
- return glExtensionName;
- }
-
+ protected Map/*<String, String>*/ getFunctionNameMap() { return null; }
+
+ protected Map/*<String, String>*/ getExtensionNameMap() { return null; }
+
protected abstract boolean create();
/**
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 641e482bc..906088642 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
@@ -71,7 +71,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
return new MacOSXOffscreenCGLDrawable(this, target);
}
- public boolean canCreateGLPbuffer() {
+ public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
return true;
}
@@ -103,7 +103,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
return MacOSXExternalCGLContext.create(this, null);
}
- public boolean canCreateExternalGLDrawable() {
+ public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
return false;
}
@@ -121,7 +121,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
return CGL.getProcAddress(glFuncName);
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java
index cc973c56a..eff01ca18 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java
@@ -42,6 +42,7 @@ package com.jogamp.opengl.impl.macosx.cgl.awt;
import java.lang.reflect.InvocationTargetException;
import java.nio.*;
import java.util.*;
+import javax.media.nativewindow.*;
import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
import com.jogamp.opengl.impl.awt.*;
@@ -53,7 +54,7 @@ public class MacOSXAWTCGLDrawableFactory extends MacOSXCGLDrawableFactory {
super();
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return true;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
index 49e646844..87a37da04 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
@@ -46,8 +46,8 @@ import com.jogamp.nativewindow.impl.NullWindow;
public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
private long hwnd, hdc;
- public WindowsDummyWGLDrawable(GLDrawableFactory factory) {
- super(factory, new NullWindow(WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(null, true, true)), true);
+ public WindowsDummyWGLDrawable(GLDrawableFactory factory, GLProfile glp) {
+ super(factory, new NullWindow(WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(glp, null, true, true)), true);
// All entries to CreateDummyWindow must synchronize on one object
// to avoid accidentally registering the dummy window class twice
synchronized (WindowsDummyWGLDrawable.class) {
@@ -56,8 +56,9 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
hdc = WGL.GetDC(hwnd);
NullWindow nw = (NullWindow) getNativeWindow();
nw.setSurfaceHandle(hdc);
+ WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
// Choose a (hopefully hardware-accelerated) OpenGL pixel format for this device context
- GLCapabilities caps = new GLCapabilities(null);
+ GLCapabilities caps = (GLCapabilities) config.getChosenCapabilities();
caps.setDepthBits(16);
PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps);
int pixelFormat = WGL.ChoosePixelFormat(hdc, pfd);
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 08c77539c..b3f4c498c 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
@@ -118,21 +118,9 @@ public class WindowsWGLContext extends GLContextImpl {
return wglExtProcAddressTable;
}
- protected String mapToRealGLFunctionName(String glFunctionName) {
- String lookup = (String) functionNameMap.get(glFunctionName);
- if (lookup != null) {
- return lookup;
- }
- return glFunctionName;
- }
+ protected Map/*<String, String>*/ getFunctionNameMap() { return functionNameMap; }
- protected String mapToRealGLExtensionName(String glExtensionName) {
- String lookup = (String) extensionNameMap.get(glExtensionName);
- if (lookup != null) {
- return lookup;
- }
- return glExtensionName;
- }
+ protected Map/*<String, String>*/ getExtensionNameMap() { return extensionNameMap; }
/**
* Creates and initializes an appropriate OpenGL context. Should only be
@@ -306,7 +294,7 @@ public class WindowsWGLContext extends GLContextImpl {
if (WGL.wglGetCurrentContext() != hglrc) {
if (!wglMakeContextCurrent(drawable.getNativeWindow().getSurfaceHandle(), drawableRead.getNativeWindow().getSurfaceHandle(), hglrc)) {
- throw new GLException("Error making context current: 0x" + Integer.toHexString(WGL.GetLastError()));
+ throw new GLException("Error making context current: 0x" + Integer.toHexString(WGL.GetLastError()) + ", " + this);
} else {
if (DEBUG && VERBOSE) {
System.err.println(getThreadName() + ": wglMakeCurrent(hdc " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) +
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 9e458c8d0..cb3ee19e0 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
@@ -85,12 +85,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
private boolean pbufferSupportInitialized = false;
private boolean canCreateGLPbuffer = false;
- public boolean canCreateGLPbuffer() {
+ public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
if (!pbufferSupportInitialized) {
final GLDrawableFactory factory = this;
Runnable r = new Runnable() {
public void run() {
- WindowsDummyWGLDrawable dummyDrawable = new WindowsDummyWGLDrawable(factory);
+ WindowsDummyWGLDrawable dummyDrawable = new WindowsDummyWGLDrawable(factory, null);
GLContext dummyContext = dummyDrawable.createContext(null);
if (dummyContext != null) {
GLContext lastContext = GLContext.getCurrent();
@@ -123,7 +123,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
final GLDrawableFactory factory = this;
Runnable r = new Runnable() {
public void run() {
- WindowsDummyWGLDrawable dummyDrawable = new WindowsDummyWGLDrawable(factory);
+ WindowsDummyWGLDrawable dummyDrawable = new WindowsDummyWGLDrawable(factory, null);
WindowsWGLContext dummyContext = (WindowsWGLContext) dummyDrawable.createContext(null);
GLContext lastContext = GLContext.getCurrent();
if (lastContext != null) {
@@ -136,10 +136,14 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
dummyDrawable,
dummyWGLExt);
returnList.add(pbufferDrawable);
- dummyContext.release();
- dummyContext.destroy();
- dummyDrawable.destroy();
} finally {
+ if(null!=dummyContext) {
+ dummyContext.release();
+ dummyContext.destroy();
+ }
+ if(null!=dummyDrawable) {
+ dummyDrawable.destroy();
+ }
if (lastContext != null) {
lastContext.makeCurrent();
}
@@ -162,7 +166,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
return WindowsExternalWGLContext.create(this, null);
}
- public boolean canCreateExternalGLDrawable() {
+ public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
return true;
}
@@ -222,7 +226,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
return detail;
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index 563173682..55b30ef3a 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -58,22 +58,17 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
return chooseGraphicsConfigurationStatic(caps, chooser, absScreen);
}
- protected static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
- GLCapabilities caps = new GLCapabilities(null);
+ protected static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(GLProfile glp, AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
+ GLCapabilities caps = new GLCapabilities(glp);
caps.setDoubleBuffered(onscreen); // FIXME DBLBUFOFFSCRN
caps.setOnscreen (onscreen);
caps.setPBuffer (usePBuffer);
- GLCapabilities caps2 = (GLCapabilities) caps.clone();
- if(!caps2.isOnscreen()) {
- // OFFSCREEN !DOUBLE_BUFFER // FIXME DBLBUFOFFSCRN
- caps2.setDoubleBuffered(false);
- }
-
if(null==absScreen) {
absScreen = DefaultGraphicsScreen.createScreenDevice(0);
}
- return new WindowsWGLGraphicsConfiguration(absScreen, caps2, caps, WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps2), -1, null);
+ return new WindowsWGLGraphicsConfiguration(absScreen, caps, caps, WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps), -1, null);
+
}
protected static WindowsWGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilities caps,
@@ -143,7 +138,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
GLContextImpl dummyContext = null;
WGLExt dummyWGLExt = null;
if (capabilities.getSampleBuffers()) {
- dummyDrawable = new WindowsDummyWGLDrawable(factory);
+ dummyDrawable = new WindowsDummyWGLDrawable(factory, glProfile);
dummyContext = (GLContextImpl) dummyDrawable.createContext(null);
if (dummyContext != null) {
dummyContext.makeCurrent();
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
new file mode 100644
index 000000000..097689967
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.opengl.impl.x11.glx;
+
+import javax.media.opengl.*;
+import com.jogamp.opengl.impl.*;
+
+import javax.media.nativewindow.*;
+import javax.media.nativewindow.x11.*;
+import com.jogamp.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.x11.*;
+
+public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
+
+ /**
+ * Due to the ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277,
+ * we cannot switch the Display as we please,
+ * hence we reuse the target's screen configuration.
+ */
+ public X11DummyGLXDrawable(X11GraphicsScreen screen, GLDrawableFactory factory, GLProfile glp) {
+ super(factory,
+ new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
+ new GLCapabilities(glp), null, screen)));
+ this.realized = true;
+
+ NullWindow nw = (NullWindow) getNativeWindow();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ GLCapabilities caps = (GLCapabilities) config.getChosenCapabilities();
+
+ long dpy = config.getScreen().getDevice().getHandle();
+ int scrn = config.getScreen().getIndex();
+ // System.out.println("X11DummyGLXDrawable: dpy "+toHexString(dpy)+", scrn "+scrn);
+ X11Lib.XLockDisplay(dpy);
+ try{
+ nw.setSurfaceHandle( X11Lib.RootWindow(dpy, scrn) );
+ } finally {
+ X11Lib.XUnlockDisplay(dpy);
+ }
+ }
+
+ public void setSize(int width, int height) {
+ }
+
+ public int getWidth() {
+ return 1;
+ }
+
+ public int getHeight() {
+ return 1;
+ }
+
+ public void destroy() {
+ // nothing to do, but allowed
+ }
+}
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 ce846c0a4..055e7236c 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
@@ -54,6 +54,7 @@ public abstract class X11GLXContext extends GLContextImpl {
private boolean glXQueryExtensionsStringInitialized;
private boolean glXQueryExtensionsStringAvailable;
private static final Map/*<String, String>*/ functionNameMap;
+ private static final Map/*<String, String>*/ extensionNameMap;
private GLXExt glXExt;
// Table that holds the addresses of the native C-language entry points for
// GLX extension functions.
@@ -63,6 +64,10 @@ public abstract class X11GLXContext extends GLContextImpl {
functionNameMap = new HashMap();
functionNameMap.put("glAllocateMemoryNV", "glXAllocateMemoryNV");
functionNameMap.put("glFreeMemoryNV", "glXFreeMemoryNV");
+
+ extensionNameMap = new HashMap();
+ extensionNameMap.put("GL_ARB_pbuffer", "GLX_SGIX_pbuffer");
+ extensionNameMap.put("GL_ARB_pixel_format", "GLX_SGIX_pbuffer"); // good enough
}
public X11GLXContext(GLDrawableImpl drawable, GLDrawableImpl drawableRead,
@@ -94,17 +99,9 @@ public abstract class X11GLXContext extends GLContextImpl {
return glXExt;
}
- protected String mapToRealGLFunctionName(String glFunctionName) {
- String lookup = (String) functionNameMap.get(glFunctionName);
- if (lookup != null) {
- return lookup;
- }
- return glFunctionName;
- }
+ protected Map/*<String, String>*/ getFunctionNameMap() { return functionNameMap; }
- protected String mapToRealGLExtensionName(String glExtensionName) {
- return glExtensionName;
- }
+ 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
@@ -363,7 +360,7 @@ public abstract class X11GLXContext extends GLContextImpl {
drawable.getNativeWindow().getSurfaceHandle(),
drawableRead.getNativeWindow().getSurfaceHandle(),
context)) {
- throw new GLException("Error making context current");
+ throw new GLException("Error making context current: "+this);
}
if (DEBUG && (VERBOSE || created)) {
System.err.println(getThreadName() + ": glXMakeCurrent(display " +
@@ -485,7 +482,8 @@ public abstract class X11GLXContext extends GLContextImpl {
public boolean isExtensionAvailable(String glExtensionName) {
if (glExtensionName.equals("GL_ARB_pbuffer") ||
glExtensionName.equals("GL_ARB_pixel_format")) {
- return getGLDrawable().getFactory().canCreateGLPbuffer();
+ return getGLDrawable().getFactory().canCreateGLPbuffer(
+ drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice() );
}
return super.isExtensionAvailable(glExtensionName);
}
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 1a254843e..60ee431dc 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
@@ -73,14 +73,29 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
return new X11OffscreenGLXDrawable(this, target);
}
- private boolean pbufferSupportInitialized = false;
- private boolean canCreateGLPbuffer = false;
- public boolean canCreateGLPbuffer() {
- if (!pbufferSupportInitialized) {
- long display = X11Util.getThreadLocalDefaultDisplay();
+ public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
+ return glxVersionGreaterEqualThan(device, 1, 3);
+ }
+
+ private boolean glxVersionsQueried = false;
+ private int glxVersionMajor=0, glxVersionMinor=0;
+ public boolean glxVersionGreaterEqualThan(AbstractGraphicsDevice device, int majorReq, int minorReq) {
+ if (!glxVersionsQueried) {
+ if(null == device) {
+ GLContext ctx = GLContext.getCurrent();
+ if( null != ctx) {
+ device = ctx.getGLDrawable().getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice();
+ }
+ }
+ if(null == device) {
+ GLException gle = new GLException("FIXME: No AbstractGraphicsDevice (passed or queried via current context - Fallback to ThreadLocal Display ..");
+ gle.printStackTrace();
+
+ device = new X11GraphicsDevice(X11Util.getThreadLocalDisplay(null));
+ }
+ long display = device.getHandle();
int[] major = new int[1];
int[] minor = new int[1];
- int screen = 0; // FIXME: provide way to specify this?
if (!GLX.glXQueryVersion(display, major, 0, minor, 0)) {
throw new GLException("glXQueryVersion failed");
@@ -94,34 +109,51 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
// only implement GLX version 1.2 on the server side
if (major[0] == 1 && minor[0] == 2) {
String str = GLX.glXGetClientString(display, GLX.GLX_VERSION);
- if (str != null && str.startsWith("1.") &&
- (str.charAt(2) >= '3')) {
- canCreateGLPbuffer = true;
+ try {
+ major[0] = Integer.valueOf(str.substring(0, 1)).intValue();
+ minor[0] = Integer.valueOf(str.substring(2, 3)).intValue();
+ } catch (NumberFormatException nfe) {
+ major[0] = 1;
+ minor[0] = 2;
}
- } else {
- canCreateGLPbuffer = ((major[0] > 1) || (minor[0] > 2));
}
- pbufferSupportInitialized = true;
+ glxVersionMajor = major[0];
+ glxVersionMinor = minor[0];
+ glxVersionsQueried = true;
}
- return canCreateGLPbuffer;
+ return ( glxVersionMajor > majorReq ) || ( glxVersionMajor == majorReq && glxVersionMinor >= minorReq ) ;
}
protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) {
+ GLDrawableImpl pbufferDrawable;
+ X11DummyGLXDrawable dummyDrawable=null;
+ GLContext dummyContext=null;
+
/**
- * FIXME: Think about this ..
- * should not be necessary ? ..
- final List returnList = new ArrayList();
- final GLDrawableFactory factory = this;
- Runnable r = new Runnable() {
- public void run() {
- returnList.add(new X11PbufferGLXDrawable(factory, target));
+ * 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,
+ * since switching Display in this regard is another ATI bug.
+ */
+ if( null == GLContext.getCurrent() ) {
+ X11GraphicsScreen screen = (X11GraphicsScreen) target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen();
+ dummyDrawable = new X11DummyGLXDrawable(screen, this, null);
+ dummyContext = dummyDrawable.createContext(null);
+ dummyContext.makeCurrent();
+ }
+ try {
+ pbufferDrawable = new X11PbufferGLXDrawable(this, target);
+ } finally {
+ if(null!=dummyContext) {
+ dummyContext.release();
+ dummyContext.destroy();
}
- };
- maybeDoSingleThreadedWorkaround(r);
- return (GLDrawableImpl) returnList.get(0);
- */
- return new X11PbufferGLXDrawable(this, target);
+ if(null!=dummyDrawable) {
+ dummyDrawable.destroy();
+ }
+ }
+ return pbufferDrawable;
}
@@ -136,8 +168,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
return X11ExternalGLXContext.create(this, null);
}
- public boolean canCreateExternalGLDrawable() {
- return canCreateGLPbuffer();
+ public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
+ return canCreateGLPbuffer(device);
}
public GLDrawable createExternalGLDrawable() {
@@ -158,7 +190,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
return res;
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
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 16e341652..72551f928 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
@@ -59,7 +59,8 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
return chooseGraphicsConfigurationStatic(capabilities, chooser, absScreen);
}
- protected static X11GLXGraphicsConfiguration createDefaultGraphicsConfiguration(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
+ /**
+ protected static X11GLXGraphicsConfiguration createDefaultGraphicsConfigurationFBConfig(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
if (absScreen == null) {
throw new IllegalArgumentException("AbstractGraphicsScreen is null");
}
@@ -110,7 +111,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
}
return new X11GLXGraphicsConfiguration(x11Screen, (null!=capsFB)?capsFB:caps, caps, null, xvis, fbcfg, fbid);
- }
+ } */
protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(Capabilities capabilities,
CapabilitiesChooser chooser,
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index d61ceb1f4..71cb3cb3b 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -173,8 +173,7 @@ public abstract class GLDrawableFactory {
destroy any GLContexts and GLDrawables that have been created
and are still in use. No further OpenGL calls may be made after
shutting down the GLDrawableFactory. */
- public void shutdown() {
- }
+ public abstract void shutdown();
//----------------------------------------------------------------------
// Methods to create high-level objects
@@ -218,7 +217,7 @@ public abstract class GLDrawableFactory {
* Returns true if it is possible to create a GLPbuffer. Some older
* graphics cards do not have this capability.
*/
- public abstract boolean canCreateGLPbuffer();
+ public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device);
/**
* Creates a Pbuffer GLDrawable with the given capabilites and dimensions. <P>
@@ -280,7 +279,7 @@ public abstract class GLDrawableFactory {
* Returns true if it is possible to create an external GLDrawable
* object via {@link #createExternalGLDrawable}.
*/
- public abstract boolean canCreateExternalGLDrawable();
+ public abstract boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device);
/**
* <P> Creates a {@link GLDrawable} object representing an existing
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 43b2e1e1d..e8de00629 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -494,7 +494,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
backend = new J2DOGLBackend();
} else {
if (!hardwareAccelerationDisabled &&
- factory.canCreateGLPbuffer()) {
+ factory.canCreateGLPbuffer(null)) {
backend = new PbufferBackend();
} else {
if (softwareRenderingDisabled) {
@@ -1509,7 +1509,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
}
}
if (joglContext == null) {
- if (factory.canCreateExternalGLDrawable()) {
+ AbstractGraphicsDevice device = j2dContext.getGLDrawable().getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice();
+ if (factory.canCreateExternalGLDrawable(device)) {
joglDrawable = factory.createExternalGLDrawable();
// FIXME: Need to share with j2d context, due to FBO resource ..
// - ORIG: joglContext = joglDrawable.createContext(shareWith);
@@ -1518,7 +1519,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
System.err.println("-- Created External Drawable: "+joglDrawable);
System.err.println("-- Created Context: "+joglContext);
}
- } else if (factory.canCreateContextOnJava2DSurface()) {
+ } else if (factory.canCreateContextOnJava2DSurface(device)) {
// Mac OS X code path
// FIXME: Need to share with j2d context, due to FBO resource ..
// - ORIG: joglContext = factory.createContextOnJava2DSurface(g, shareWith);
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java
index 9fc986180..95fd6c72b 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java
@@ -113,11 +113,11 @@ public class X11Util {
return 0;
}
long dpy = namedDpy.getHandle();
- X11Lib.XCloseDisplay(dpy);
if(DEBUG) {
- Exception e = new Exception("X11Util.Display: Closed TLS Display("+name+") with handle 0x"+Long.toHexString(dpy)+" in thread "+Thread.currentThread().getName());
+ Exception e = new Exception("X11Util.Display: Closing TLS Display("+name+") with handle 0x"+Long.toHexString(dpy)+" in thread "+Thread.currentThread().getName());
e.printStackTrace();
}
+ X11Lib.XCloseDisplay(dpy);
return dpy;
}