diff options
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase')
-rwxr-xr-x | src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase | 55 |
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); } //---------------------------------------------------------------------- |