예제 #1
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);
       }
     }
   }
 }
예제 #2
0
 protected void copyImpl(GLContext source, int mask) throws GLException {
   long dst = getHandle();
   long src = source.getHandle();
   if (!isNSContext()) {
     if (((MacOSXCGLContext) source).isNSContext()) {
       throw new GLException("Source OpenGL Context is NS ; Destination Context is CGL.");
     }
     CGL.CGLCopyContext(src, dst, mask);
   } else {
     if (!((MacOSXCGLContext) source).isNSContext()) {
       throw new GLException("Source OpenGL Context is CGL ; Destination Context is NS.");
     }
     CGL.copyContext(dst, src, mask);
   }
 }