Exemplo n.º 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();
  }
Exemplo n.º 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);
       }
     }
   }
 }
Exemplo n.º 3
0
 public void dispose() {
   readBufferUtil.dispose();
 }