summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java23
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java34
2 files changed, 53 insertions, 4 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 511b857af..01c8db09d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
@@ -207,15 +207,23 @@ public class Texture {
<pre>
gl.glEnable(texture.getTarget());
</pre>
- *
+ *
+ * <p>
+ * Call is ignored if {@link #getTarget()} is {@link GLES2#GL_TEXTURE_EXTERNAL_OES}.
+ * </p>
+ * <p>
* See the <a href="#perftips">performance tips</a> above for hints
* on how to maximize performance when using many Texture objects.
+ * </p>
+ * @param gl the current GL object
*
* @throws GLException if no OpenGL context was current or if any
* OpenGL-related errors occurred
*/
public void enable(GL gl) throws GLException {
- gl.glEnable(target);
+ if(GLES2.GL_TEXTURE_EXTERNAL_OES != target) {
+ gl.glEnable(target);
+ }
}
/**
@@ -226,15 +234,22 @@ public class Texture {
gl.glDisable(texture.getTarget());
</pre>
*
+ * <p>
+ * Call is ignored if {@link #getTarget()} is {@link GLES2#GL_TEXTURE_EXTERNAL_OES}.
+ * </p>
+ * <p>
* See the <a href="#perftips">performance tips</a> above for hints
* on how to maximize performance when using many Texture objects.
- * @param gl TODO
+ * </p>
+ * @param gl the current GL object
*
* @throws GLException if no OpenGL context was current or if any
* OpenGL-related errors occurred
*/
public void disable(GL gl) throws GLException {
- gl.glDisable(target);
+ if(GLES2.GL_TEXTURE_EXTERNAL_OES != target) {
+ gl.glDisable(target);
+ }
}
/**
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
index 8d8b3679d..61f5d116c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
@@ -36,6 +36,8 @@
package com.jogamp.opengl.util.texture;
+import java.nio.FloatBuffer;
+
/** Specifies texture coordinates for a rectangular area of a
texture. Note that some textures are inherently flipped vertically
from OpenGL's standard coordinate system. This class takes care of
@@ -61,6 +63,38 @@ public class TextureCoords {
this.top = top;
}
+ /** Transfers <code>{s * ss, t * ts}</code> from this object into the given <code>float[8+d_off]</code> in the following order:
+ * <pre>
+ * left, bottom
+ * right, bottom
+ * left, top
+ * right top
+ * </pre>
+ */
+ public float[] getST_LB_RB_LT_RT(float[] d, int d_off, float ss, float ts) {
+ d[0+d_off] = left *ss; d[1+d_off] = bottom*ts;
+ d[2+d_off] = right *ss; d[3+d_off] = bottom*ts;
+ d[4+d_off] = left *ss; d[5+d_off] = top *ts;
+ d[6+d_off] = right *ss; d[7+d_off] = top *ts;
+ return d;
+ }
+
+ /** Transfers <code>{s * ss, t * ts}</code> from this object into the given FloatBuffer in the following order:
+ * <pre>
+ * left, bottom
+ * right, bottom
+ * left, top
+ * right top
+ * </pre>
+ */
+ public FloatBuffer getST_LB_RB_LT_RT(FloatBuffer d, float ss, float ts) {
+ d.put( left *ss); d.put( bottom*ts);
+ d.put( right *ss); d.put( bottom*ts);
+ d.put( left *ss); d.put( top *ts);
+ d.put( right *ss); d.put( top *ts);
+ return d;
+ }
+
/** Returns the leftmost (x) texture coordinate of this
rectangle. */
public float left() { return left; }