From 3ea949b6a14c1ba631cb41b7439af86b21db4c05 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 4 Sep 2011 10:24:42 +0200 Subject: NativeWindow/JOGL: Cleanup Caps doc and implicit related values. Capabilities setBackgroundOpaque -> setAlphaBits GLCapabilities setOnscreen <-> setPBuffer setSampleBuffers -> setAlphaBits --- .../javax/media/nativewindow/Capabilities.java | 51 ++++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'src/nativewindow/classes/javax') diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java index b162392da..d02efb04f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java +++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java @@ -194,32 +194,35 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl this.alphaBits = alphaBits; } - /** For on-screen OpenGL contexts on some platforms, sets whether - the background of the context should be considered opaque. On - supported platforms, setting this to false, in conjunction with - the transparency values, may allow - hardware-accelerated OpenGL content inside of windows of - arbitrary shape. To achieve this effect it is necessary to use - an OpenGL clear color with an alpha less than 1.0. The default - value for this flag is true; setting it to false - may incur a certain performance penalty, so it is not - recommended to arbitrarily set it to false.
- If not set already, the transparency values for red, green, blue and alpha - are set to their default value, which is half of the value range - of the framebuffer's corresponding component, - ie redValue = ( 1 << ( redBits - 1 ) ) -1 . - */ + /** + * Defaults to true, ie. opaque surface. + *

+ * On supported platforms, setting opaque to false may result in a translucent surface.

+ * + *

+ * Platform implementations may need an alpha component in the surface (eg. Windows), + * or expect pre-multiplied alpha values (eg. X11/XRender).
+ * To unify the experience, this method also invokes {@link #setAlphaBits(int) setAlphaBits(1)} + * if {@link #getAlphaBits()} == 0.
+ * Please note that in case alpha is required on the platform the + * clear color shall have an alpha lower than 1.0 to allow anything shining through. + *

+ * + *

+ * Mind that translucency may cause a performance penalty + * due to the composite work required by the window manager.

+ * + *

+ * The platform implementation may utilize the transparency RGBA values.
+ * This is true for the original GLX transparency specification, which is no more used today.
+ * Actually these values are currently not used by any implementation, + * so we may mark them deprecated soon, if this doesn't change.
+ *

+ */ public void setBackgroundOpaque(boolean opaque) { backgroundOpaque = opaque; - if(!opaque) { - if(transparentValueRed<0) - transparentValueRed = ( 1 << ( getRedBits() - 1 ) ) - 1 ; - if(transparentValueGreen<0) - transparentValueGreen = ( 1 << ( getGreenBits() - 1 ) ) - 1 ; - if(transparentValueBlue<0) - transparentValueBlue = ( 1 << ( getBlueBits() - 1 ) ) - 1 ; - if(transparentValueAlpha<0) - transparentValueAlpha = ( 1 << ( getAlphaBits() - 1 ) ) - 1 ; + if(!opaque && getAlphaBits()==0) { + setAlphaBits(1); } } -- cgit v1.2.3