From 92bd50ffee67d14566ffacacad3f9a3227025d21 Mon Sep 17 00:00:00 2001
From: Sven Gothel
+ * Due to many confusions w/ texture usage, following list described the order
+ * and semantics of texture unit selection, binding and enabling.
+ * Order of Texture Commands
+ *
+ *
+ * gl.glActiveTexture(GL.GL_TEXTURE0 + textureUnit)
, 0
is default.textureId
-> active textureUnit
's textureTarget
via gl.glBindTexture(textureTarget, textureId)
textureUnit
's textureTarget
via glEnable(textureTarget)
.
+ * textureUnit
in your shader program, enable shader program.
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.*;