aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-09-07 05:46:22 +0200
committerSven Gothel <[email protected]>2012-09-07 05:46:22 +0200
commit90d45928186f2be99999461cfe45f76a783cc961 (patch)
treef0e06551a5f71c7b15c737e73718ee4f2ca200bc /src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
parent3ee639687c4d1e2431066f7dfe7a922b569079ec (diff)
Fix Capabilities ambiguity and explosion of queried available-list; Add FBO availability detection for EGL, WGL and OSX.
Introducing Capabilities 'bitmap' boolean, complementing the offscreen modes FBO and PBuffer. This allows: 1 - deterministic setting of the offscreen mode 2 - utilizing auto configuration of offscreen mode, if !onscreen !FBO !PBuffer and !Bitmap 3 - adding 'availability' semantic of 'onscreen' boolean, i.e. if onscree:=1 for a queried instance, the offscreen modes still indicate offscreen availability - see [4] 4 - avoiding explosion of the availability list due to [3], one Capability entry reflect on- and offscreen settings. Add FBO availability detection for EGL, WGL and OSX. Tested manually w/ 'TestGLCapabilities01NEWT' on X11 [NV, ATI], WGL[NV], OSX[NV].
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java')
-rw-r--r--src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
index 5fa8ce32d..b052769ca 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
@@ -87,20 +87,20 @@ import jogamp.opengl.Debug;
public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
private static final boolean DEBUG = Debug.isPropertyDefined("jogl.debug.CapabilitiesChooser", true);
- final static int NO_SCORE = -9999999;
- final static int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000;
- final static int OPAQUE_MISMATCH_PENALTY = 750;
- final static int STENCIL_MISMATCH_PENALTY = 500;
- final static int MULTISAMPLE_MISMATCH_PENALTY = 500;
- final static int MULTISAMPLE_EXTENSION_MISMATCH_PENALTY = 250; // just a little drop, no scale
+ private final static int NO_SCORE = -9999999;
+ private final static int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000;
+ private final static int OPAQUE_MISMATCH_PENALTY = 750;
+ private final static int STENCIL_MISMATCH_PENALTY = 500;
+ private final static int MULTISAMPLE_MISMATCH_PENALTY = 500;
+ private final static int MULTISAMPLE_EXTENSION_MISMATCH_PENALTY = 250; // just a little drop, no scale
// Pseudo attempt to keep equal rank penalties scale-equivalent
// (e.g., stencil mismatch is 3 * accum because there are 3 accum
// components)
- final static int COLOR_MISMATCH_PENALTY_SCALE = 36;
- final static int DEPTH_MISMATCH_PENALTY_SCALE = 6;
- final static int ACCUM_MISMATCH_PENALTY_SCALE = 1;
- final static int STENCIL_MISMATCH_PENALTY_SCALE = 3;
- final static int MULTISAMPLE_MISMATCH_PENALTY_SCALE = 3;
+ private final static int COLOR_MISMATCH_PENALTY_SCALE = 36;
+ private final static int DEPTH_MISMATCH_PENALTY_SCALE = 6;
+ private final static int ACCUM_MISMATCH_PENALTY_SCALE = 1;
+ private final static int STENCIL_MISMATCH_PENALTY_SCALE = 3;
+ private final static int MULTISAMPLE_MISMATCH_PENALTY_SCALE = 3;
@Override
public int chooseCapabilities(final CapabilitiesImmutable desired,
@@ -150,11 +150,20 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
if (cur == null) {
continue;
}
- if (gldes.isOnscreen() != cur.isOnscreen()) {
- continue;
+ if (gldes.isOnscreen() && !cur.isOnscreen()) {
+ continue; // requested onscreen, but n/a
}
- if (!gldes.isOnscreen() && gldes.isPBuffer() && !cur.isPBuffer()) {
- continue; // only skip if requested Offscreen && PBuffer, but no PBuffer available
+ if (!gldes.isOnscreen()) {
+ /** FBO is generic ..
+ if (gldes.isFBO() && !cur.isFBO()) {
+ continue; // requested FBO, but n/a
+ } */
+ if (gldes.isPBuffer() && !cur.isPBuffer()) {
+ continue; // requested pBuffer, but n/a
+ }
+ if (gldes.isBitmap() && !cur.isBitmap()) {
+ continue; // requested pBuffer, but n/a
+ }
}
if (gldes.getStereo() != cur.getStereo()) {
continue;