diff options
Diffstat (limited to 'src/demos/readbuffer/ReadBuffer2File.java')
-rwxr-xr-x | src/demos/readbuffer/ReadBuffer2File.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/demos/readbuffer/ReadBuffer2File.java b/src/demos/readbuffer/ReadBuffer2File.java index 2b30acf..ef908c4 100755 --- a/src/demos/readbuffer/ReadBuffer2File.java +++ b/src/demos/readbuffer/ReadBuffer2File.java @@ -37,7 +37,7 @@ import java.nio.*; import javax.media.opengl.*; import com.sun.opengl.util.texture.TextureData; -import com.sun.opengl.util.texture.spi.NetPbmTextureWriter; +import com.sun.opengl.util.texture.TextureIO; import java.io.File; import java.io.IOException; @@ -53,14 +53,17 @@ public class ReadBuffer2File extends ReadBufferBase { super.dispose(drawable); } - NetPbmTextureWriter textureWriter = new NetPbmTextureWriter(6); int shotNum=0; void copyTextureData2File() { if(!readBufferUtil.isValid()) return; try { - textureWriter.write(new File("/tmp/shot/shot-"+shotNum+"."+textureWriter.getSuffix()), readBufferUtil.getTextureData()); + File file = File.createTempFile("shot"+shotNum+"-", ".ppm"); + TextureIO.write(readBufferUtil.getTextureData(), file); + if(0==shotNum) { + System.out.println("Wrote: "+file.getAbsolutePath()+", ..."); + } shotNum++; } catch (IOException ioe) { ioe.printStackTrace(); } readBufferUtil.rewindPixelBuffer(); |