aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/math/Vec2f.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java20
2 files changed, 30 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/math/Vec2f.java b/src/jogl/classes/com/jogamp/math/Vec2f.java
index 547f63a05..94a2ffc62 100644
--- a/src/jogl/classes/com/jogamp/math/Vec2f.java
+++ b/src/jogl/classes/com/jogamp/math/Vec2f.java
@@ -48,6 +48,10 @@ public final class Vec2f {
set(o);
}
+ public Vec2f(final Vec2i o) {
+ set(o);
+ }
+
/** Creating new Vec2f using Vec3f, dropping z. */
public Vec2f(final Vec3f o) {
set(o);
@@ -71,6 +75,12 @@ public final class Vec2f {
this.y = o.y;
}
+ /** this = o (int -> float), returns this. */
+ public void set(final Vec2i o) {
+ this.x = o.x();
+ this.y = o.y();
+ }
+
/** this = o while dropping z, returns this. */
public void set(final Vec3f o) {
this.x = o.x();
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 1c2d5f510..7c1f4584e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
@@ -285,6 +285,26 @@ public class Texture {
throw new GLException("External texture ID invalid: texID "+textureID);
}
}
+ /**
+ * Pending setup or update of texture and image dimensions
+ * @param texWidth the width of the texture in pixels
+ * @param texHeight the height of the texture in pixels
+ * @param imgWidth the width of the image within the texture in
+ * pixels (if the content is a sub-rectangle in the upper
+ * left corner); otherwise, pass in texWidth
+ * @param imgHeight the height of the image within the texture in
+ * pixels (if the content is a sub-rectangle in the upper
+ * left corner); otherwise, pass in texHeight
+ */
+ public void set(final int texWidth, final int texHeight,
+ final int imgWidth, final int imgHeight) {
+ this.texWidth = texWidth;
+ this.texHeight = texHeight;
+ this.aspectRatio = (float) imgWidth / (float) imgHeight;
+ this.imgWidth = imgWidth;
+ this.imgHeight = imgHeight;
+ this.updateTexCoords();
+ }
/**
* Enables this texture's target (e.g., GL_TEXTURE_2D) in the