summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-18 08:39:57 +0200
committerSven Gothel <[email protected]>2013-04-18 08:39:57 +0200
commitdb24615ebaebcda88ffb7275d3a60e6400226099 (patch)
tree6ca4580b8450f037af7046abeade8f5e902e13e6 /src/jogl/classes/jogamp
parentd173feb60d085399194549102d4b3d77512c3f73 (diff)
Bug 718: Further restriction of Windows BITMAP PFD's - RGB888 and !alpha only
On Windows Vista machines, using alpha, i.e. RGB8888 failed to SetPixelFormat(..), hence only allow RGB888.
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java2
3 files changed, 5 insertions, 4 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
index d69b02bb9..654d286d3 100644
--- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
+++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
@@ -287,7 +287,7 @@ public class GLGraphicsConfigurationUtil {
return capsRequested;
}
- public static GLCapabilitiesImmutable clipRGBAGLCapabilities(GLCapabilitiesImmutable caps, boolean allowRGB555)
+ public static GLCapabilitiesImmutable clipRGBAGLCapabilities(GLCapabilitiesImmutable caps, boolean allowRGB555, boolean allowAlpha)
{
final int iR = caps.getRedBits();
final int iG = caps.getGreenBits();
@@ -296,7 +296,7 @@ public class GLGraphicsConfigurationUtil {
final int oR = clipColor(iR, allowRGB555);
final int oG = clipColor(iG, allowRGB555);
final int oB = clipColor(iB, allowRGB555);
- final int oA = 0 < iA ? oR : 0 ; // align alpha to red if requested
+ final int oA = ( allowAlpha && 0 < iA ) ? oR : 0 ; // align alpha to red if requested and allowed
if( iR != oR || iG != oG || iB != oB || iA != oA ) {
final GLCapabilities caps2 = (GLCapabilities) caps.cloneMutable();
caps2.setRedBits(oR);
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
index a7f62fccf..3c326e93e 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
@@ -91,7 +91,8 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable {
final GLCapabilitiesImmutable capsChosen;
{
final GLCapabilitiesImmutable capsChosen0 = (GLCapabilitiesImmutable)config.getChosenCapabilities();
- capsChosen = GLGraphicsConfigurationUtil.clipRGBAGLCapabilities(capsChosen0, false /* allowRGB555 */);
+ // RGB555 and also alpha channel is experienced to fail on some Windows machines
+ capsChosen = GLGraphicsConfigurationUtil.clipRGBAGLCapabilities(capsChosen0, false /* allowRGB555 */, false /* allowAlpha */);
if( capsChosen0 != capsChosen ) {
config.setChosenCapabilities(capsChosen);
if(DEBUG) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 3b71c4462..017f8c40b 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -610,7 +610,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
if( GLGraphicsConfigurationUtil.BITMAP_BIT == drawableTypeBits ) {
// BITMAP exclusive PFD SafeGuard: Only accept BITMAP compatible color formats!
final int pfdColorBits = pfd.getCColorBits();
- if ( pfdColorBits != 24 || pfd.getCRedBits() < pfd.getCAlphaBits() ) { // Allowed: RGB888 && alpha <= red
+ if ( pfdColorBits != 24 || 0 < pfd.getCAlphaBits() ) { // Allowed: RGB888 && !alpha
if(DEBUG) {
System.err.println("Drop [color bits excl BITMAP]: " + WGLGLCapabilities.PFD2String(pfd, pfdID));
}