diff options
author | Kenneth Russel <[email protected]> | 2006-01-09 02:37:43 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2006-01-09 02:37:43 +0000 |
commit | b464faaae70ba12e5842b901a6c6d1601af0e1c7 (patch) | |
tree | 6411322c882c48dfe04870adf981c33609fabefa /src/classes/com/sun/opengl/utils/Texture.java | |
parent | c1e4d8a8937ecce5bbc88c6de604ce35e793b9cc (diff) |
Added output support to TGAImage, SGIImage and newly-renamed DDSImage
classes. Added support to TextureIO for writing textures back to disk
via new TextureWriter plug-in interface. Added TextureConvert demo
which shows how an application might convert between arbitrary file
formats using these APIs, including automatic compression to DXT3
format when available.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@525 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/utils/Texture.java')
-rwxr-xr-x | src/classes/com/sun/opengl/utils/Texture.java | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/classes/com/sun/opengl/utils/Texture.java b/src/classes/com/sun/opengl/utils/Texture.java index efecdffea..924161d69 100755 --- a/src/classes/com/sun/opengl/utils/Texture.java +++ b/src/classes/com/sun/opengl/utils/Texture.java @@ -79,7 +79,7 @@ public class Texture { // For now make Texture constructor package-private to limit the // number of public APIs we commit to Texture(TextureData data) throws GLException { - GL gl = getCurrentGL(); + GL gl = GLU.getCurrentGL(); texID = createTextureID(gl); updateImage(data); @@ -88,7 +88,7 @@ public class Texture { // Constructor for use when creating e.g. cube maps, where there is // no initial texture data Texture(int target) throws GLException { - GL gl = getCurrentGL(); + GL gl = GLU.getCurrentGL(); texID = createTextureID(gl); this.target = target; } @@ -101,7 +101,7 @@ public class Texture { * OpenGL-related errors occurred */ public void enable() throws GLException { - getCurrentGL().glEnable(target); + GLU.getCurrentGL().glEnable(target); } /** @@ -112,7 +112,7 @@ public class Texture { * OpenGL-related errors occurred */ public void disable() throws GLException { - getCurrentGL().glDisable(target); + GLU.getCurrentGL().glDisable(target); } /** @@ -122,7 +122,7 @@ public class Texture { * OpenGL-related errors occurred */ public void bind() throws GLException { - getCurrentGL().glBindTexture(target, texID); + GLU.getCurrentGL().glBindTexture(target, texID); } /** @@ -132,7 +132,7 @@ public class Texture { * OpenGL-related errors occurred */ public void dispose() throws GLException { - getCurrentGL().glDeleteTextures(1, new int[] {texID}, 0); + GLU.getCurrentGL().glDeleteTextures(1, new int[] {texID}, 0); texID = 0; } @@ -242,6 +242,17 @@ public class Texture { } /** + * Indicates whether this texture's texture coordinates must be + * flipped vertically in order to properly display the texture. This + * is handled automatically by {@link #getImageTexCoords} and {@link + * #getSubImageTexCoords}, but applications may generate or + * otherwise produce texture coordinates which must be corrected. + */ + public boolean getMustFlipVertically() { + return mustFlipVertically; + } + + /** * Updates the content area of the specified target of this texture * using the data in the given image. In general this is intended * for construction of cube maps. @@ -250,7 +261,7 @@ public class Texture { * OpenGL-related errors occurred */ public void updateImage(TextureData data, int target) throws GLException { - GL gl = getCurrentGL(); + GL gl = GLU.getCurrentGL(); imgWidth = data.getWidth(); imgHeight = data.getHeight(); @@ -395,7 +406,7 @@ public class Texture { public void setTexParameteri(int parameterName, int value) { bind(); - GL gl = getCurrentGL(); + GL gl = GLU.getCurrentGL(); gl.glTexParameteri(target, parameterName, value); } @@ -413,18 +424,6 @@ public class Texture { // /** - * Returns the current GL object. Throws GLException if no OpenGL - * context was current. - */ - private static GL getCurrentGL() throws GLException { - GLContext context = GLContext.getCurrent(); - if (context == null) { - throw new GLException("No OpenGL context current on current thread"); - } - return context.getGL(); - } - - /** * Returns true if the given value is a power of two. * * @return true if the given value is a power of two, false otherwise @@ -475,7 +474,7 @@ public class Texture { } private void updateSubImageImpl(TextureData data, int newTarget, int mipmapLevel, int x, int y) throws GLException { - GL gl = getCurrentGL(); + GL gl = GLU.getCurrentGL(); gl.glBindTexture(newTarget, texID); int width = data.getWidth(); int height = data.getHeight(); |