aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-11 07:41:31 -0700
committerSven Gothel <[email protected]>2009-10-11 07:41:31 -0700
commit8f76db4364f66c36780e762e086a18d5cc315363 (patch)
tree6c3291b08c76018bda59ad6fe3acf8fe686d0eb4 /src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase
parent6f6436ab9c7345f4d3b7bf5d8ee70addc9f11ab0 (diff)
NEWT X11 Display Lock:
Integrate Display.lock/unlock, so the generic Window will call it. Specialized for X11Display, the only real impl of it. Fixes offscreen EDT usage .. GLProfile: Add isAWTAvailable() and isAWTJOGLAvailable() TextureIO: - Add NetPbmTextureWriter - Only use IIOTexture* if !isAWTJOGLAvailable() - Add write (TextureData, File)
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase')
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase55
1 files changed, 32 insertions, 23 deletions
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase b/src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase
index 2b2f123a0..556d51343 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase
+++ b/src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase
@@ -640,6 +640,10 @@ public class TextureIO {
}
}
+ write(data, file);
+ }
+
+ public static void write(TextureData data, File file) throws IOException, GLException {
for (Iterator iter = textureWriters.iterator(); iter.hasNext(); ) {
TextureWriter writer = (TextureWriter) iter.next();
if (writer.write(file, data)) {
@@ -647,7 +651,7 @@ public class TextureIO {
}
}
- throw new IOException("No suitable texture writer found");
+ throw new IOException("No suitable texture writer found for "+file.getAbsolutePath());
}
//----------------------------------------------------------------------
@@ -710,14 +714,16 @@ public class TextureIO {
static {
// ImageIO provider, the fall-back, must be the first one added
- try {
- // Use reflection to avoid compile-time dependencies on AWT-related classes
- TextureProvider provider = (TextureProvider)
- Class.forName("com.sun.opengl.util.texture.spi.awt.IIOTextureProvider").newInstance();
- addTextureProvider(provider);
- } catch (Exception e) {
- if (DEBUG) {
- e.printStackTrace();
+ if(GLProfile.isAWTJOGLAvailable()) {
+ try {
+ // Use reflection to avoid compile-time dependencies on AWT-related classes
+ TextureProvider provider = (TextureProvider)
+ Class.forName("com.sun.opengl.util.texture.spi.awt.IIOTextureProvider").newInstance();
+ addTextureProvider(provider);
+ } catch (Exception e) {
+ if (DEBUG) {
+ e.printStackTrace();
+ }
}
}
@@ -727,18 +733,20 @@ public class TextureIO {
addTextureProvider(new TGATextureProvider());
// ImageIO writer, the fall-back, must be the first one added
- try {
- // Use reflection to avoid compile-time dependencies on AWT-related classes
- TextureWriter writer = (TextureWriter)
- Class.forName("com.sun.opengl.util.texture.spi.awt.IIOTextureWriter").newInstance();
- addTextureWriter(writer);
- } catch (Exception e) {
- if (DEBUG) {
- e.printStackTrace();
- }
- } catch (Error e) {
- if (DEBUG) {
- e.printStackTrace();
+ if(GLProfile.isAWTJOGLAvailable()) {
+ try {
+ // Use reflection to avoid compile-time dependencies on AWT-related classes
+ TextureWriter writer = (TextureWriter)
+ Class.forName("com.sun.opengl.util.texture.spi.awt.IIOTextureWriter").newInstance();
+ addTextureWriter(writer);
+ } catch (Exception e) {
+ if (DEBUG) {
+ e.printStackTrace();
+ }
+ } catch (Error e) {
+ if (DEBUG) {
+ e.printStackTrace();
+ }
}
}
@@ -746,6 +754,7 @@ public class TextureIO {
addTextureWriter(new DDSTextureWriter());
addTextureWriter(new SGITextureWriter());
addTextureWriter(new TGATextureWriter());
+ addTextureWriter(new NetPbmTextureWriter());
}
// Implementation methods
@@ -772,7 +781,7 @@ public class TextureIO {
}
}
- throw new IOException("No suitable reader for given file");
+ throw new IOException("No suitable reader for given file "+file.getAbsolutePath());
}
private static TextureData newTextureDataImpl(InputStream stream,
@@ -829,7 +838,7 @@ public class TextureIO {
}
}
- throw new IOException("No suitable reader for given URL");
+ throw new IOException("No suitable reader for given URL "+url);
}
//----------------------------------------------------------------------