예제 #1
0
  public void surface2File(String basename) throws IOException {
    if (!readBufferUtil.isValid()) {
      return;
    }

    File file = File.createTempFile(basename + shotNum + "-", ".ppm");
    TextureIO.write(readBufferUtil.getTextureData(), file);
    System.out.println("Wrote: " + file.getAbsolutePath() + ", ...");
    shotNum++;
    readBufferUtil.rewindPixelBuffer();
  }
예제 #2
0
 public void surfaceUpdated(Object updater, NativeWindow window, long when) {
   if (updater instanceof GLDrawable) {
     GLDrawable drawable = (GLDrawable) updater;
     GLContext ctx = GLContext.getCurrent();
     if (null != ctx && ctx.getGLDrawable() == drawable) {
       GL gl = ctx.getGL();
       // FIXME glFinish() is an expensive paranoia sync, should not be necessary due to spec
       gl.glFinish();
       readBufferUtil.fetchOffscreenTexture(drawable, gl);
       gl.glFinish();
       try {
         surface2File("shot");
       } catch (IOException ex) {
         throw new RuntimeException("can not write survace to file", ex);
       }
     }
   }
 }
예제 #3
0
 public void dispose() {
   readBufferUtil.dispose();
 }