aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-09-03 01:57:20 +0000
committerKenneth Russel <[email protected]>2008-09-03 01:57:20 +0000
commitd25261f80e380d87e48db01a3c888a7ca843797b (patch)
tree47fdcdf331fe18887f9c9c4c80900a26dfa5e430 /src
parent9b7dd620a29c872df82d4deb2aeda06c07d19d48 (diff)
Added TextureIO.newTexture wrapping an OpenGL texture ID from an
external library git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1770 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-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.