aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-09-03 03:13:45 +0200
committerSven Gothel <[email protected]>2011-09-03 03:13:45 +0200
commitbbdd6f95687da343bf7a6550c3bc9bb4444116e5 (patch)
tree027da6de1a88bc143b1d2f4edb4cadcf68d8546f /src/jogl/classes
parent9955e053ac28d1dc1f6722893d7989d5e2b710c3 (diff)
Complete translucency support (core w/ X11 (only) - tested w/ NEWT)
DefaultGLCapabilitiesChooser: - Add penalty for opaque mismatch: dbl-buf > opaq > stencil GLGraphicsConfigurationFactory: - Case no-chooser && has-recommended-idx: - Only use recommended index if caps is opaque, otherwise use default chooser to validate translucency NativeWindow Capabilities: - transparent default values -> 0 Added NEWT Test: TestTranslucencyNEWT Added command line translucency/undecorated options for TestGearsES2NEWT
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java19
-rw-r--r--src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java4
2 files changed, 14 insertions, 9 deletions
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
index 52628f6fa..be509c332 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
@@ -120,16 +120,18 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
// Create score array
int[] scores = new int[availnum];
- int NO_SCORE = -9999999;
- int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000;
- int STENCIL_MISMATCH_PENALTY = 500;
+ final int NO_SCORE = -9999999;
+ final int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000;
+ final int OPAQUE_MISMATCH_PENALTY = 750;
+ final int STENCIL_MISMATCH_PENALTY = 500;
// Pseudo attempt to keep equal rank penalties scale-equivalent
// (e.g., stencil mismatch is 3 * accum because there are 3 accum
// components)
- int COLOR_MISMATCH_PENALTY_SCALE = 36;
- int DEPTH_MISMATCH_PENALTY_SCALE = 6;
- int ACCUM_MISMATCH_PENALTY_SCALE = 1;
- int STENCIL_MISMATCH_PENALTY_SCALE = 3;
+ final int COLOR_MISMATCH_PENALTY_SCALE = 36;
+ final int DEPTH_MISMATCH_PENALTY_SCALE = 6;
+ final int ACCUM_MISMATCH_PENALTY_SCALE = 1;
+ final int STENCIL_MISMATCH_PENALTY_SCALE = 3;
+
for (int i = 0; i < scores.length; i++) {
scores[i] = NO_SCORE;
}
@@ -166,6 +168,9 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
if (cur.getDoubleBuffered() != gldes.getDoubleBuffered()) {
score += sign(score) * DOUBLE_BUFFER_MISMATCH_PENALTY;
}
+ if (cur.isBackgroundOpaque() != gldes.isBackgroundOpaque()) {
+ score += sign(score) * OPAQUE_MISMATCH_PENALTY;
+ }
if ((gldes.getStencilBits() > 0) && (cur.getStencilBits() == 0)) {
score += sign(score) * STENCIL_MISMATCH_PENALTY;
}
diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java
index e51e997a3..6fe9f080c 100644
--- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java
@@ -49,9 +49,9 @@ public abstract class GLGraphicsConfigurationFactory extends GraphicsConfigurati
return -1; // none available
}
- if(null == chooser && 0 <= recommendedIndex) {
+ if(null == chooser && 0 <= recommendedIndex && capsRequested.isBackgroundOpaque()) {
if (DEBUG) {
- System.err.println("chooseCapabilities: Using recommendedIndex: idx " + recommendedIndex);
+ System.err.println("chooseCapabilities: Using recommendedIndex (opaque): idx " + recommendedIndex);
}
return recommendedIndex;
}