From 92bd50ffee67d14566ffacacad3f9a3227025d21 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 3 Jul 2013 16:56:41 +0200 Subject: Texture: Add 'Order of Texture Commansa' and their semantics to API doc .. due to lot's of confusions. --- .../com/jogamp/opengl/util/texture/Texture.java | 39 +++++++++++++++------- 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'src/jogl/classes/com') 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 bf85bea87..d6a8090fb 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -52,18 +52,32 @@ import com.jogamp.opengl.util.texture.spi.*; * Represents an OpenGL texture object. Contains convenience routines * for enabling/disabling OpenGL texture state, binding this texture, * and computing texture coordinates for both the entire image as well - * as a sub-image. + * as a sub-image. + * + *
Order of Texture Commands
+ *

+ * Due to many confusions w/ texture usage, following list described the order + * and semantics of texture unit selection, binding and enabling. + *

+ *

* *

Non-power-of-two restrictions *
When creating an OpenGL texture object, the Texture class will - * attempt to leverage the GL_ARB_texture_non_power_of_two - * and GL_ARB_texture_rectangle - * extensions (in that order) whenever possible. If neither extension - * is available, the Texture class will simply upload a non-pow2-sized + * attempt to use non-power-of-two textures (NPOT) if available, see {@link GL#isNPOTTextureAvailable()}. + * Further more, + * GL_ARB_texture_rectangle + * (RECT) will be attempted on OSX w/ ATI drivers. + * If NPOT is not available or RECT not chosen, the Texture class will simply upload a non-pow2-sized * image into a standard pow2-sized texture (without any special - * scaling). Since the choice of extension (or whether one is used at + * scaling). + * Since the choice of extension (or whether one is used at * all) depends on the user's machine configuration, developers are * recommended to use {@link #getImageTexCoords} and {@link * #getSubImageTexCoords}, as those methods will calculate the @@ -91,9 +105,12 @@ import com.jogamp.opengl.util.texture.spi.*; * when switching between textures it is necessary to call {@link * #bind}, but when drawing many triangles all using the same texture, * for best performance only one call to {@link #bind} should be made. + * User may also utilize multiple texture units, + * see order of texture commands above. * *

Alpha premultiplication and blending - *
The mathematically correct way to perform blending in OpenGL + *
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 @@ -138,9 +155,7 @@ import com.jogamp.opengl.util.texture.spi.*; AlphaXor GL_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_SRC_ALPHA - * - * @author Chris Campbell - * @author Kenneth Russell + * @author Chris Campbell, Kenneth Russell, et.al. */ public class Texture { /** The GL target type. */ -- cgit v1.2.3