aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com')
-rwxr-xr-xsrc/classes/com/sun/opengl/util/texture/Texture.java17
-rwxr-xr-xsrc/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp39
-rwxr-xr-xsrc/classes/com/sun/opengl/util/texture/TextureIO.java.javase39
3 files changed, 95 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/util/texture/Texture.java b/src/classes/com/sun/opengl/util/texture/Texture.java
index aed480fe0..4e8c206bc 100755
--- a/src/classes/com/sun/opengl/util/texture/Texture.java
+++ b/src/classes/com/sun/opengl/util/texture/Texture.java
@@ -189,6 +189,23 @@ public class Texture {
this.target = target;
}
+ // Package-private constructor for creating a texture object which wraps
+ // an existing texture ID from another package
+ Texture(int textureID,
+ int target,
+ int texWidth,
+ int texHeight,
+ int imgWidth,
+ int imgHeight,
+ boolean mustFlipVertically) {
+ this.texID = textureID;
+ this.target = target;
+ this.mustFlipVertically = mustFlipVertically;
+ this.texWidth = texWidth;
+ this.texHeight = texHeight;
+ setImageSize(imgWidth, imgHeight, target);
+ }
+
/**
* Enables this texture's target (e.g., GL_TEXTURE_2D) in the
* current GL context's state. This method is a shorthand equivalent
diff --git a/src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp b/src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp
index f39f1e4c0..fe4724310 100755
--- a/src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp
+++ b/src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp
@@ -490,6 +490,45 @@ public class TextureIO {
}
/**
+ * Wraps an OpenGL texture ID from an external library and allows
+ * some of the base methods from the Texture class, such as
+ * binding and querying of texture coordinates, to be used with
+ * it. Attempts to update such textures' contents will yield
+ * undefined results.
+ *
+ * @param textureID the OpenGL texture object to wrap
+ * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D,
+ * GL2.GL_TEXTURE_RECTANGLE
+ * @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
+ * @param mustFlipVertically indicates whether the texture
+ * coordinates must be flipped vertically
+ * in order to properly display the
+ * texture
+ */
+ public static Texture newTexture(int textureID,
+ int target,
+ int texWidth,
+ int texHeight,
+ int imgWidth,
+ int imgHeight,
+ boolean mustFlipVertically) {
+ return new Texture(textureID,
+ target,
+ texWidth,
+ texHeight,
+ imgWidth,
+ imgHeight,
+ mustFlipVertically);
+ }
+
+ /**
* Writes the given texture to a file. The type of the file is
* inferred from its suffix. An OpenGL context must be current in
* order to fetch the texture data back from the OpenGL pipeline.
diff --git a/src/classes/com/sun/opengl/util/texture/TextureIO.java.javase b/src/classes/com/sun/opengl/util/texture/TextureIO.java.javase
index ebb59fa6f..2cb2d2c9f 100755
--- a/src/classes/com/sun/opengl/util/texture/TextureIO.java.javase
+++ b/src/classes/com/sun/opengl/util/texture/TextureIO.java.javase
@@ -490,6 +490,45 @@ public class TextureIO {
}
/**
+ * Wraps an OpenGL texture ID from an external library and allows
+ * some of the base methods from the Texture class, such as
+ * binding and querying of texture coordinates, to be used with
+ * it. Attempts to update such textures' contents will yield
+ * undefined results.
+ *
+ * @param textureID the OpenGL texture object to wrap
+ * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D,
+ * GL2.GL_TEXTURE_RECTANGLE
+ * @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
+ * @param mustFlipVertically indicates whether the texture
+ * coordinates must be flipped vertically
+ * in order to properly display the
+ * texture
+ */
+ public static Texture newTexture(int textureID,
+ int target,
+ int texWidth,
+ int texHeight,
+ int imgWidth,
+ int imgHeight,
+ boolean mustFlipVertically) {
+ return new Texture(textureID,
+ target,
+ texWidth,
+ texHeight,
+ imgWidth,
+ imgHeight,
+ mustFlipVertically);
+ }
+
+ /**
* Writes the given texture to a file. The type of the file is
* inferred from its suffix. An OpenGL context must be current in
* order to fetch the texture data back from the OpenGL pipeline.