aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-04-15 07:24:20 +0200
committerSven Gothel <[email protected]>2010-04-15 07:24:20 +0200
commitbd4904fb04ab2168aeaf76e74385b3991429289a (patch)
treec21cc1e959caecbeaed109506acbfb8b853eeda2
parent2ae28d54858ff684bc2368e0476a7a357dc63432 (diff)
JOGL (Windows):
- WindowsWGLDrawableFactory is using [singleton] shared dummy resources for - Drawable and Context which are utilized in case they are needed .. They are removed at shutdown call - GLCapabilities - Set pbuffer as the HW capabilities show, hence onscreen && pbuffer is valid - DefaultGLCapabilitiesChooser: Respect PBuffer selection (fixed) Only skip a config, if request is !onscreen && pbuffer, but pbuffer n/a Tests: - JUnit Passed (Windows32: Chromium - Except PBuffer (n/a)
-rwxr-xr-xmake/java-run-newt.sh23
-rwxr-xr-xmake/java-run.sh19
-rw-r--r--make/java-win32-dbg.bat16
-rw-r--r--make/java-win32.bat16
-rw-r--r--make/setenv-jogl.sh92
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java101
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java5
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java34
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java5
-rw-r--r--src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java4
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java2
14 files changed, 244 insertions, 85 deletions
diff --git a/make/java-run-newt.sh b/make/java-run-newt.sh
new file mode 100755
index 000000000..39654d03b
--- /dev/null
+++ b/make/java-run-newt.sh
@@ -0,0 +1,23 @@
+#! /bin/sh
+
+function print_usage() {
+ echo "Usage: $0 jogl-build-dir ..."
+}
+
+if [ -z "$1" ] ; then
+ echo JOGL BUILD DIR missing
+ print_usage
+ return
+fi
+
+. ./setenv-jogl.sh $1
+shift
+
+MOSX=0
+uname -a | grep -i Darwin && MOSX=1
+
+if [ $MOSX -eq 1 ] ; then
+ X_ARGS="-XstartOnFirstThread"
+fi
+
+java $X_ARGS -Djava.awt.headless=true com.jogamp.newt.util.MainThread $* 2>&1 | tee java-run-newt.log
diff --git a/make/java-run.sh b/make/java-run.sh
new file mode 100755
index 000000000..63fb6d3e9
--- /dev/null
+++ b/make/java-run.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+function print_usage() {
+ echo "Usage: $0 jogl-build-dir ..."
+}
+
+if [ -z "$1" ] ; then
+ echo JOGL BUILD DIR missing
+ print_usage
+ return
+fi
+
+. ./setenv-jogl.sh $1
+shift
+
+MOSX=0
+uname -a | grep -i Darwin && MOSX=1
+
+java $X_ARGS $* 2>&1 | tee java-run.log
diff --git a/make/java-win32-dbg.bat b/make/java-win32-dbg.bat
new file mode 100644
index 000000000..69287f8e9
--- /dev/null
+++ b/make/java-win32-dbg.bat
@@ -0,0 +1,16 @@
+
+set BLD_SUB=build-win32
+set J2RE_HOME=c:\jre1.6.0_19
+set JAVA_HOME=c:\jdk1.6.0_19
+set ANT_PATH=C:\apache-ant-1.8.0
+
+set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
+
+set BLD_DIR=..\%BLD_SUB%
+set LIB_DIR=%BLD_DIR%\lib;..\..\gluegen\%BLD_SUB%\obj
+
+set CP_ALL=.;%BLD_DIR%\jogl\jogl.all.jar;%BLD_DIR%\nativewindow\nativewindow.all.jar;%BLD_DIR%\newt\newt.all.jar;%BLD_DIR%\jogl\jogl.test.jar;..\..\gluegen\%BLD_SUB%\gluegen-rt.jar;..\..\gluegen\make\lib\junit-4.5.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar
+
+echo CP_ALL %CP_ALL%
+
+%J2RE_HOME%\bin\java -classpath %CP_ALL% "-Djava.library.path=%LIB_DIR%" "-Dnativewindow.debug=all" "-Djogl.debug=all" "-Dnewt.debug=all" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win32-dbg.log 2>&1
diff --git a/make/java-win32.bat b/make/java-win32.bat
new file mode 100644
index 000000000..5f731a14d
--- /dev/null
+++ b/make/java-win32.bat
@@ -0,0 +1,16 @@
+
+set BLD_SUB=build-win32
+set J2RE_HOME=c:\jre1.6.0_19
+set JAVA_HOME=c:\jdk1.6.0_19
+set ANT_PATH=C:\apache-ant-1.8.0
+
+set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
+
+set BLD_DIR=..\%BLD_SUB%
+set LIB_DIR=%BLD_DIR%\lib;..\..\gluegen\%BLD_SUB%\obj
+
+set CP_ALL=.;%BLD_DIR%\jogl\jogl.all.jar;%BLD_DIR%\nativewindow\nativewindow.all.jar;%BLD_DIR%\newt\newt.all.jar;%BLD_DIR%\jogl\jogl.test.jar;..\..\gluegen\%BLD_SUB%\gluegen-rt.jar;..\..\gluegen\make\lib\junit-4.5.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar
+
+echo CP_ALL %CP_ALL%
+
+%J2RE_HOME%\bin\java -classpath %CP_ALL% "-Djava.library.path=%LIB_DIR%" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win32.log 2>&1
diff --git a/make/setenv-jogl.sh b/make/setenv-jogl.sh
new file mode 100644
index 000000000..49c584459
--- /dev/null
+++ b/make/setenv-jogl.sh
@@ -0,0 +1,92 @@
+#! /bin/sh
+
+function print_usage() {
+ echo "Usage: $0 jogl-build-dir"
+}
+
+if [ -z "$1" ] ; then
+ echo JOGL BUILD DIR missing
+ print_usage
+ return
+fi
+
+if [ -e /devtools/etc/profile.ant ] ; then
+ . /devtools/etc/profile.ant
+fi
+
+JOGL_PROFILE=JOGL_ALL
+
+JOGL_BUILDDIR=$1
+shift
+
+THISDIR=`pwd`
+
+if [ -e "$JOGL_BUILDDIR" ] ; then
+ JOGL_DIR=$JOGL_BUILDDIR/..
+ JOGL_BUILDDIR_BASE=`basename $JOGL_BUILDDIR`
+else
+ echo JOGL_BUILDDIR $JOGL_BUILDDIR not exist or not given
+ print_usage
+ return
+fi
+
+gpf=`find ../../gluegen/make -name dynlink-unix.cfg`
+if [ -z "$gpf" ] ; then
+ gpf=`find .. -name dynlink-unix.cfg`
+fi
+if [ -z "$gpf" ] ; then
+ echo GLUEGEN_BUILDDIR not found
+ print_usage
+ return
+fi
+
+GLUEGEN_DIR=`dirname $gpf`/..
+GLUEGEN_BUILDDIR=$GLUEGEN_DIR/$JOGL_BUILDDIR_BASE
+if [ ! -e "$GLUEGEN_BUILDDIR" ] ; then
+ echo GLUEGEN_BUILDDIR $GLUEGEN_BUILDDIR does not exist
+ print_usage
+ return
+fi
+GLUEGEN_JAR=$GLUEGEN_BUILDDIR/gluegen-rt.jar
+GLUEGEN_OS=$GLUEGEN_BUILDDIR/obj
+JUNIT_JAR=$GLUEGEN_DIR/make/lib/junit-4.5.jar
+
+if [ -z "$ANT_PATH" ] ; then
+ echo ANT_PATH does not exist, set it
+ print_usage
+ return
+else
+ ANT_JARS=$ANT_PATH/lib/ant.jar:$ANT_PATH/lib/ant-junit.jar
+fi
+
+echo GLUEGEN BUILDDIR: $GLUEGEN_BUILDDIR
+echo JOGL DIR: $JOGL_DIR
+echo JOGL BUILDDIR: $JOGL_BUILDDIR
+echo JOGL BUILDDIR BASE: $JOGL_BUILDDIR_BASE
+echo JOGL PROFILE: $JOGL_PROFILE
+
+J2RE_HOME=$(which java)
+JAVA_HOME=$(which javac)
+CP_SEP=:
+
+. $JOGL_DIR/etc/profile.jogl $JOGL_PROFILE $JOGL_BUILDDIR
+
+SWT_CLASSPATH=$HOME/.java/swt.jar
+LIB=$THISDIR/lib
+
+CLASSPATH=.:$GLUEGEN_JAR:$JOGL_CLASSPATH:$SWT_CLASSPATH:$JUNIT_JAR:$ANT_JARS
+for i in $LIB/*jar ; do
+ CLASSPATH=$CLASSPATH:$i
+done
+export CLASSPATH
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR
+export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR
+
+echo CLASSPATH: $CLASSPATH
+echo
+echo MacOSX REMEMBER to add the JVM arguments "-XstartOnFirstThread -Djava.awt.headless=true" for running demos without AWT, e.g. NEWT
+echo MacOSX REMEMBER to add the JVM arguments "-XstartOnFirstThread -Djava.awt.headless=true com.jogamp.newt.util.MainThread" for running demos with NEWT
+
+PATH=$J2RE_HOME/bin:$JAVA_HOME/bin:$PATH
+export PATH
+
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
index 616640bad..0cc10b35e 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
@@ -79,9 +79,6 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
GLCapabilities caps = (GLCapabilities) target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
GLDrawable result = null;
if(caps.isOnscreen()) {
- if(caps.isPBuffer()) {
- throw new IllegalArgumentException("Onscreen target can't be PBuffer: "+caps);
- }
if(DEBUG) {
System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable: "+target);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java
index 2d5154442..176628633 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java
@@ -179,11 +179,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
} */
}
if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_SURFACE_TYPE, val, 0)) {
- if(EGLConfigDrawableTypeVerify(val[0], onscreen, usePBuffer)) {
- caps.setDoubleBuffered(onscreen);
- caps.setOnscreen(onscreen);
- caps.setPBuffer(usePBuffer);
- } else if(relaxed) {
+ if(EGLConfigDrawableTypeVerify(val[0], onscreen, usePBuffer) || relaxed) {
caps.setDoubleBuffered( 0 != (val[0] & EGL.EGL_WINDOW_BIT) );
caps.setOnscreen( 0 != (val[0] & EGL.EGL_WINDOW_BIT) );
caps.setPBuffer ( 0 != (val[0] & EGL.EGL_PBUFFER_BIT) );
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 cb3ee19e0..e3938f9fe 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
@@ -43,6 +43,7 @@ import com.jogamp.common.os.DynamicLookupHelper;
import java.nio.*;
import java.util.*;
import javax.media.nativewindow.*;
+import javax.media.nativewindow.windows.*;
import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
import com.jogamp.nativewindow.impl.NWReflection;
@@ -72,7 +73,45 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
loadOpenGL32Library();
}
+ WindowsDummyWGLDrawable sharedDrawable=null;
+ WindowsWGLContext sharedContext=null;
+ boolean canCreateGLPbuffer = false;
+
+ void initShared() {
+ if(null==sharedDrawable) {
+ sharedDrawable = new WindowsDummyWGLDrawable(this, null);
+ sharedContext = (WindowsWGLContext) sharedDrawable.createContext(null);
+ sharedContext.makeCurrent();
+ canCreateGLPbuffer = sharedContext.getGL().isExtensionAvailable("GL_ARB_pbuffer");
+ sharedContext.release();
+ if (DEBUG) {
+ System.err.println("!!! SharedContext: "+sharedContext+", pbuffer supported "+canCreateGLPbuffer);
+ }
+ if(null==sharedContext) {
+ throw new GLException("Couldn't init shared resources");
+ }
+ }
+ }
+
+ public void shutdown() {
+ super.shutdown();
+ if (DEBUG) {
+ System.err.println("!!! Shutdown Shared:");
+ System.err.println("!!! CTX : "+sharedContext);
+ System.err.println("!!! Drawable: "+sharedDrawable);
+ Exception e = new Exception("Debug");
+ e.printStackTrace();
+ }
+ if(null!=sharedContext) {
+ sharedContext.destroy(); // implies release, if current
+ }
+ if(null!=sharedDrawable) {
+ sharedDrawable.destroy();
+ }
+ }
+
public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
+ validate();
if (target == null) {
throw new IllegalArgumentException("Null target");
}
@@ -83,67 +122,33 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
return new WindowsOffscreenWGLDrawable(this, target);
}
- private boolean pbufferSupportInitialized = false;
- private boolean canCreateGLPbuffer = false;
public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
- if (!pbufferSupportInitialized) {
- final GLDrawableFactory factory = this;
- Runnable r = new Runnable() {
- public void run() {
- WindowsDummyWGLDrawable dummyDrawable = new WindowsDummyWGLDrawable(factory, null);
- GLContext dummyContext = dummyDrawable.createContext(null);
- if (dummyContext != null) {
- GLContext lastContext = GLContext.getCurrent();
- if (lastContext != null) {
- lastContext.release();
- }
- dummyContext.makeCurrent();
- GL dummyGL = dummyContext.getGL();
- canCreateGLPbuffer = dummyGL.isExtensionAvailable("GL_ARB_pbuffer");
- pbufferSupportInitialized = true;
- dummyContext.release();
- dummyContext.destroy();
- dummyDrawable.destroy();
- if (lastContext != null) {
- lastContext.makeCurrent();
- }
- }
- }
- };
- maybeDoSingleThreadedWorkaround(r);
- }
- if (DEBUG) {
- System.err.println("WindowsWGLDrawableFactory.canCreateGLPbuffer() = " + canCreateGLPbuffer);
- }
+ validate();
+ initShared();
return canCreateGLPbuffer;
}
protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) {
+ initShared();
final List returnList = new ArrayList();
final GLDrawableFactory factory = this;
+ final WindowsWGLContext _sharedContext = sharedContext;
+ final WindowsDummyWGLDrawable _sharedDrawable = sharedDrawable;
Runnable r = new Runnable() {
public void run() {
- WindowsDummyWGLDrawable dummyDrawable = new WindowsDummyWGLDrawable(factory, null);
- WindowsWGLContext dummyContext = (WindowsWGLContext) dummyDrawable.createContext(null);
GLContext lastContext = GLContext.getCurrent();
if (lastContext != null) {
lastContext.release();
}
- dummyContext.makeCurrent();
- WGLExt dummyWGLExt = dummyContext.getWGLExt();
+ _sharedContext.makeCurrent();
+ WGLExt wglExt = _sharedContext.getWGLExt();
try {
GLDrawableImpl pbufferDrawable = new WindowsPbufferWGLDrawable(factory, target,
- dummyDrawable,
- dummyWGLExt);
+ _sharedDrawable,
+ wglExt);
returnList.add(pbufferDrawable);
} finally {
- if(null!=dummyContext) {
- dummyContext.release();
- dummyContext.destroy();
- }
- if(null!=dummyDrawable) {
- dummyDrawable.destroy();
- }
+ _sharedContext.release();
if (lastContext != null) {
lastContext.makeCurrent();
}
@@ -163,18 +168,22 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
public GLContext createExternalGLContext() {
+ validate();
return WindowsExternalWGLContext.create(this, null);
}
public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
+ validate();
return true;
}
public GLDrawable createExternalGLDrawable() {
+ validate();
return WindowsExternalWGLDrawable.create(this, null);
}
public void loadOpenGL32Library() {
+ validate();
if (hopengl32 == 0) {
hopengl32 = WGL.LoadLibraryA("OpenGL32");
if (DEBUG) {
@@ -186,6 +195,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
public void loadGLULibrary() {
+ validate();
if (hglu32 == 0) {
hglu32 = WGL.LoadLibraryA("GLU32");
if (hglu32 == 0) {
@@ -195,6 +205,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
public long dynamicLookupFunction(String glFuncName) {
+ validate();
long res = WGL.wglGetProcAddress(glFuncName);
if (res == 0) {
// It may happen that a driver doesn't return the OpenGL32 core function pointer
@@ -227,11 +238,13 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
+ validate();
return false;
}
public GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith)
throws GLException {
+ validate();
throw new GLException("Unimplemented on this platform");
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index aed4012a4..15823b6dc 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -428,10 +428,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
boolean relaxed, boolean onscreen, boolean usePBuffer) {
GLCapabilities res = new GLCapabilities(glp);
int drawableTypeBits = WGLConfig2DrawableTypeBits(iattribs, niattribs, iresults);
- if(WGLConfigDrawableTypeVerify(drawableTypeBits, onscreen, usePBuffer)) {
- res.setOnscreen(onscreen);
- res.setPBuffer(usePBuffer);
- } else if(relaxed) {
+ if(WGLConfigDrawableTypeVerify(drawableTypeBits, onscreen, usePBuffer) || relaxed) {
res.setOnscreen( 0 != (drawableTypeBits & WINDOW_BIT) );
res.setPBuffer ( 0 != (drawableTypeBits & PBUFFER_BIT) );
} else {
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 1a375699c..c9805fef1 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
@@ -87,7 +87,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
protected static void updateGraphicsConfiguration(CapabilitiesChooser chooser,
- GLDrawableFactory factory, NativeWindow nativeWindow) {
+ GLDrawableFactory _factory, NativeWindow nativeWindow) {
+ WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory;
if (nativeWindow == null) {
throw new IllegalArgumentException("NativeWindow is null");
}
@@ -134,25 +135,16 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
// Produce a recommended pixel format selection for the GLCapabilitiesChooser.
// Use wglChoosePixelFormatARB if user requested multisampling and if we have it available
- WindowsWGLDrawable dummyDrawable = null;
- GLContextImpl dummyContext = null;
- WGLExt dummyWGLExt = null;
- if (capabilities.getSampleBuffers()) {
- dummyDrawable = new WindowsDummyWGLDrawable(factory, glProfile);
- dummyContext = (GLContextImpl) dummyDrawable.createContext(null);
- if (dummyContext != null) {
- dummyContext.makeCurrent();
- dummyWGLExt = (WGLExt) dummyContext.getPlatformGLExtensions();
- }
- } else if (DEBUG) {
- System.err.println(getThreadName() + ": Not using WGL_ARB_pixel_format, because multisampling not requested");
- }
+ factory.initShared();
+ factory.sharedContext.makeCurrent();
+ WGLExt wglExt = factory.sharedContext.getWGLExt();
+
int recommendedPixelFormat = pixelFormat; // 1-based pixel format
boolean haveWGLChoosePixelFormatARB = false;
boolean gotAvailableCaps = false;
- if (dummyWGLExt != null) {
+ if (wglExt != null) {
try {
- haveWGLChoosePixelFormatARB = dummyWGLExt.isExtensionAvailable("WGL_ARB_pixel_format");
+ haveWGLChoosePixelFormatARB = wglExt.isExtensionAvailable("WGL_ARB_pixel_format");
if (haveWGLChoosePixelFormatARB) {
if(pixelFormat<=0) {
int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS];
@@ -160,12 +152,12 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
if(WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities,
iattributes,
- dummyWGLExt,
+ wglExt,
false,
null)) {
int[] pformats = new int[WindowsWGLGraphicsConfiguration.MAX_PFORMATS];
int[] numFormatsTmp = new int[1];
- if (dummyWGLExt.wglChoosePixelFormatARB(hdc,
+ if (wglExt.wglChoosePixelFormatARB(hdc,
iattributes, 0,
fattributes, 0,
WindowsWGLGraphicsConfiguration.MAX_PFORMATS,
@@ -196,16 +188,14 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
}
- availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(dummyWGLExt, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer);
+ availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(wglExt, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer);
gotAvailableCaps = null!=availableCaps ;
choosenBywGLPixelFormat = gotAvailableCaps ;
} else if (DEBUG) {
System.err.println(getThreadName() + ": wglChoosePixelFormatARB not available");
}
} finally {
- dummyContext.release();
- dummyContext.destroy();
- dummyDrawable.destroy();
+ factory.sharedContext.release();
}
}
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 eda480d5f..cfcd5cbe3 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
@@ -99,6 +99,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
if (DEBUG) {
System.err.println("!!! SharedContext: "+sharedContext);
}
+ if(null==sharedContext) {
+ throw new GLException("Couldn't init shared resources");
+ }
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
index 35daf0ae0..393891bab 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -250,10 +250,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
GLCapabilities res = new GLCapabilities(glp);
val = glXGetFBConfig(display, fbcfg, GLX.GLX_DRAWABLE_TYPE, tmp, 0);
- if(GLXFBConfigDrawableTypeVerify(val, onscreen, usePBuffer)) {
- res.setOnscreen(onscreen);
- res.setPBuffer(usePBuffer);
- } else if(relaxed) {
+ if(GLXFBConfigDrawableTypeVerify(val, onscreen, usePBuffer) || relaxed) {
res.setOnscreen( 0 != (val & GLX.GLX_WINDOW_BIT) );
res.setPBuffer ( 0 != (val & GLX.GLX_PBUFFER_BIT) );
} else {
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
index c5ded88f6..ee41c9161 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
@@ -138,8 +138,8 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
if (_desired.isOnscreen() != cur.isOnscreen()) {
continue;
}
- if (_desired.isPBuffer() != cur.isPBuffer()) {
- continue;
+ if (!_desired.isOnscreen() && _desired.isPBuffer() && !cur.isPBuffer()) {
+ continue; // only skip if requested Offscreen && PBuffer, but no PBuffer available
}
if (_desired.getStereo() != cur.getStereo()) {
continue;
diff --git a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
index 5abf02b97..c2661ed3c 100755
--- a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
@@ -112,7 +112,7 @@ public class TestDrawable01NEWT {
Assert.assertTrue(glCaps.getBlueBits()>5);
Assert.assertTrue(glCaps.getRedBits()>5);
Assert.assertTrue(glCaps.isOnscreen()==onscreen);
- Assert.assertTrue(glCaps.isPBuffer()==(!onscreen && pbuffer));
+ Assert.assertTrue(onscreen || !pbuffer || glCaps.isPBuffer()); // pass if onscreen, or !pbuffer req. or have pbuffer
Assert.assertTrue(glCaps.getDoubleBuffered()==!onscreen);
Assert.assertTrue(glCaps.getDepthBits()>4);