From 35fcf49d1cb49e3844e7cee44f34d827d8a102ce Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Tue, 2 Jul 2013 22:24:08 +0200
Subject: Bug 724: Add manual unit test, incr. PNGImage verbosity.
---
src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'src/jogl/classes/com')
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java
index b4b00e744..93d37029e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java
@@ -177,7 +177,8 @@ public class PNGImage {
}
if(DEBUG) {
System.err.println("PNGImage: "+imgInfo);
- System.err.println("PNGImage: indexed "+indexed+", alpha "+hasAlpha+", channels "+channels+", bytesPerPixel "+bytesPerPixel+
+ System.err.println("PNGImage: indexed "+indexed+", alpha "+hasAlpha+", channels "+channels+"/"+imgInfo.channels+
+ ", bytesPerPixel "+bytesPerPixel+"/"+imgInfo.bytesPixel+
", pixels "+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+"x"+dpi[1]+", glFormat 0x"+Integer.toHexString(glFormat));
}
--
cgit v1.2.3
From 9b6efe652c8be325734c04cd6603d6014cbc886a Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Wed, 3 Jul 2013 11:45:04 +0200
Subject: GLContext: Rename 2-digit VersionNumber statics aligning w/ all
3-digit names, e.g. Version31 -> Version310. ; Trim GLVersionNumber string.
---
make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java | 2 +-
.../com/jogamp/opengl/util/glsl/ShaderUtil.java | 2 +-
src/jogl/classes/javax/media/opengl/GLContext.java | 20 ++++++++++----------
src/jogl/classes/jogamp/opengl/GLContextImpl.java | 4 ++--
src/jogl/classes/jogamp/opengl/GLVersionNumber.java | 4 ++--
5 files changed, 16 insertions(+), 16 deletions(-)
(limited to 'src/jogl/classes/com')
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
index bfe2759c0..fbe7484c4 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
@@ -63,7 +63,7 @@ private final void initBufferObjectExtensionChecks() {
haveGL15 = isExtensionAvailable("GL_VERSION_1_5");
haveGL21 = isExtensionAvailable("GL_VERSION_2_1");
haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object");
- haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version30) >= 0 ||
+ haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version300) >= 0 ||
isExtensionAvailable("GL_ARB_vertex_array_object");
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
index 7d110659a..066b2054d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
@@ -221,7 +221,7 @@ public class ShaderUtil {
/** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */
public static boolean isGeometryShaderSupported(GL _gl) {
final GLContext ctx = _gl.getContext();
- return ctx.getGLVersionNumber().compareTo(GLContext.Version32) >= 0 ||
+ return ctx.getGLVersionNumber().compareTo(GLContext.Version320) >= 0 ||
ctx.isExtensionAvailable(GLExtensions.ARB_geometry_shader4);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index cc37da0ff..84d371ac6 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -131,16 +131,16 @@ public abstract class GLContext {
/* Version 1.50, i.e. GLSL 1.50 for GL 3.2. */
public static final VersionNumber Version150 = new VersionNumber(1, 50, 0);
- /** Version 3.2. As an OpenGL version, it qualifies for geometry shader */
- public static final VersionNumber Version32 = new VersionNumber(3, 2, 0);
+ /** Version 3.0. As an OpenGL version, it qualifies for desktop {@link #isGL2()} only, or ES 3.0. */
+ public static final VersionNumber Version300 = new VersionNumber(3, 0, 0);
/** Version 3.1. As an OpenGL version, it qualifies for {@link #isGL3core()}, {@link #isGL3bc()} and {@link #isGL3()} */
- public static final VersionNumber Version31 = new VersionNumber(3, 1, 0);
+ public static final VersionNumber Version310 = new VersionNumber(3, 1, 0);
- /** Version 3.0. As an OpenGL version, it qualifies for {@link #isGL2()} only */
- public static final VersionNumber Version30 = new VersionNumber(3, 0, 0);
+ /** Version 3.2. As an OpenGL version, it qualifies for geometry shader */
+ public static final VersionNumber Version320 = new VersionNumber(3, 2, 0);
- protected static final VersionNumber Version80 = new VersionNumber(8, 0, 0);
+ protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0);
/** ARB_create_context
related: created via ARB_create_context. Cache key value. See {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
protected static final int CTX_IS_ARB_CREATED = 1 << 0;
@@ -753,7 +753,7 @@ public abstract class GLContext {
return "";
}
final int minor = ctxGLSLVersion.getMinor();
- final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version30) >= 0 ? " es" : "";
+ final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : "";
return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + esSuffix + "\n" ;
}
@@ -899,21 +899,21 @@ public abstract class GLContext {
/** @see GLProfile#isGL3bc() */
public final boolean isGL3bc() {
- return ctxVersion.compareTo(Version31) >= 0
+ return ctxVersion.compareTo(Version310) >= 0
&& 0 != (ctxOptions & CTX_IS_ARB_CREATED)
&& 0 != (ctxOptions & CTX_PROFILE_COMPAT);
}
/** @see GLProfile#isGL3() */
public final boolean isGL3() {
- return ctxVersion.compareTo(Version31) >= 0
+ return ctxVersion.compareTo(Version310) >= 0
&& 0 != (ctxOptions & CTX_IS_ARB_CREATED)
&& 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE));
}
/** Indicates whether this profile is capable of GL3 (core only). GL3 starts w/ OpenGL 3.1 Includes [ GL4, GL3 ].
*/
public final boolean isGL3core() {
- return ctxVersion.compareTo(Version31) >= 0
+ return ctxVersion.compareTo(Version310) >= 0
&& 0 != (ctxOptions & CTX_IS_ARB_CREATED)
&& 0 != (ctxOptions & CTX_PROFILE_CORE);
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index d6f97662e..956ba4659 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -671,7 +671,7 @@ public abstract class GLContextImpl extends GLContext {
if( 0 == ( ctxOptions & GLContext.CTX_PROFILE_ES) ) { // not ES profile
final int reqMajor;
final int reqProfile;
- if( ctxVersion.compareTo(Version30) <= 0 ) {
+ if( ctxVersion.compareTo(Version300) <= 0 ) {
reqMajor = 2;
} else {
reqMajor = ctxVersion.getMajor();
@@ -1605,7 +1605,7 @@ public abstract class GLContextImpl extends GLContext {
//
final int quirk = GLRendererQuirks.DontCloseX11Display;
if( glRenderer.contains(MesaSP) ) {
- if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version80) < 0 ) {
+ if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version800) < 0 ) {
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 Renderer=" + glRenderer + ", Version=[vendor " + vendorVersion + ", GL " + glVersion+"]");
}
diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java
index cea3ac4ab..e4187b35b 100644
--- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java
+++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java
@@ -110,7 +110,7 @@ public class GLVersionNumber extends VersionNumberString {
String str;
{
final GLVersionNumber glv = create(versionString);
- str = versionString.substring(glv.endOfStringMatch());
+ str = versionString.substring(glv.endOfStringMatch()).trim();
}
while ( str.length() > 0 ) {
@@ -120,7 +120,7 @@ public class GLVersionNumber extends VersionNumberString {
if( version.hasMajor() && version.hasMinor() ) { // Requires at least a defined major and minor version component!
return version;
}
- str = str.substring( eosm );
+ str = str.substring( eosm ).trim();
} else {
break; // no match
}
--
cgit v1.2.3
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.
+ *
+ * - Optional: Set active textureUnit via
gl.glActiveTexture(GL.GL_TEXTURE0 + textureUnit)
, 0
is default.
+ * - Bind
textureId
-> active textureUnit
's textureTarget
via gl.glBindTexture(textureTarget, textureId)
+ * - Compatible Context Only: Enable active
textureUnit
's textureTarget
via glEnable(textureTarget)
.
+ * - Optional: Fiddle with the texture parameters and/or environment settings.
+ * - GLSL: Use
textureUnit
in your shader program, enable shader program.
+ * - Issue draw commands
+ *
+ *
*
* 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
|