diff options
author | Sven Gothel <[email protected]> | 2014-05-19 23:22:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-05-19 23:22:49 +0200 |
commit | 1a10db565491d27d135cff898efec58e45cc306f (patch) | |
tree | c4a18a441c6071dcbac3e01822731e9e3ed46cc5 | |
parent | c8b1eb11f143bb1d0b276554ff1455d8b7616e33 (diff) |
Texture/TextureIO: Make 'wrapping' Texture ctor public, remove same factory method from TextureIO
3 files changed, 35 insertions, 50 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 584cacf8c..47be0714e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -210,17 +210,44 @@ public class Texture { updateImage(gl, data); } - // Constructor for use when creating e.g. cube maps, where there is - // no initial texture data + /** + * Constructor for use when creating e.g. cube maps, where there is + * no initial texture data + * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D, + * GL2.GL_TEXTURE_RECTANGLE + */ public Texture(int target) { texID = 0; 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) { + /** + * Constructor to wrap 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 Texture(final int textureID, final int target, + final int texWidth, final int texHeight, + final int imgWidth, final int imgHeight, + final boolean mustFlipVertically) { this.texID = textureID; this.target = target; this.mustFlipVertically = mustFlipVertically; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java index 0f64fd007..b2bcd0de3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java @@ -554,45 +554,6 @@ 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/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index 63bb22d80..49c3c2a13 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -725,11 +725,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, texWrapST[0]); gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, texWrapST[1]); - return com.jogamp.opengl.util.texture.TextureIO.newTexture( - texName, textureTarget, - tWidth, tHeight, - width, height, - !isInGLOrientation); + return new Texture(texName, textureTarget, + tWidth, tHeight, width, height, !isInGLOrientation); } protected void destroyTexFrame(GL gl, TextureFrame frame) { |