From 55e480cd487e3089fae9b836eb213cd7c6b3d79a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 17 Jul 2013 00:04:47 +0200 Subject: Texture: Fix 'premultiply alpha' semantics in API doc description. Texture class does _nor_ premultiply RGBA image data by default! --- .../com/jogamp/opengl/util/texture/Texture.java | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java index 2be2f6575..f2ef3ac25 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -109,15 +109,20 @@ import com.jogamp.opengl.util.texture.spi.*; * see order of texture commands above. * *

Alpha premultiplication and blending - *
Disclaimer: Consider performing alpha premultiplication in shader code, if really desired! Otherwise use RGBA. - *
The mathematically correct way to perform blending in OpenGL - * (with the SrcOver "source over destination" mode, or any other - * Porter-Duff rule) is to use "premultiplied color components", which - * means the R/G/ B color components have already been multiplied by - * the alpha value. To make things easier for developers, the Texture - * class will automatically convert non-premultiplied image data into - * premultiplied data when storing it into an OpenGL texture. As a - * result, it is important to use the correct blending function; for + *

+ * Disclaimer: Consider performing alpha premultiplication in shader code, if really desired! Otherwise use RGBA.
+ *

+ *

+ * The Texture class does not convert RGBA image data into + * premultiplied data when storing it into an OpenGL texture. + *

+ *

+ * The mathematically correct way to perform blending in OpenGL + * with the SrcOver "source over destination" mode, or any other + * Porter-Duff rule, is to use premultiplied color components, + * which means the R/G/ B color components must have been multiplied by + * the alpha value. If using premultiplied color components + * it is important to use the correct blending function; for * example, the SrcOver rule is expressed as:

     gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA);
-- 
cgit v1.2.3