public synchronized static void exportCurrentScreen(final Renderer renderer, final ScreenExportable exportable) { final ImageDataFormat format = exportable.getFormat(); final Camera camera = Camera.getCurrentCamera(); final int width = camera.getWidth(), height = camera.getHeight(); // prepare our data buffer final int size = renderer.getExpectedBufferSizeToGrabScreenContents(format, PixelDataType.UnsignedByte, width, height); if (_scratch.capacity() < size) { _scratch = BufferUtils.createByteBuffer(size); } else { _scratch.limit(size); _scratch.rewind(); } // Ask the renderer for the current scene to be stored in the buffer renderer.grabScreenContents(_scratch, format, 0, 0, width, height); // send the buffer to the exportable object for processing. exportable.export(_scratch, width, height); } }
public synchronized static void exportCurrentScreen(final Renderer renderer, final ScreenExportable exportable) { final ImageDataFormat format = exportable.getFormat(); final Camera camera = Camera.getCurrentCamera(); final int width = camera.getWidth(), height = camera.getHeight(); // prepare our data buffer final int size = renderer.getExpectedBufferSizeToGrabScreenContents(format, PixelDataType.UnsignedByte, width, height); if (_scratch.capacity() < size) { _scratch = BufferUtils.createByteBuffer(size); } else { _scratch.limit(size); _scratch.rewind(); } // Ask the renderer for the current scene to be stored in the buffer renderer.grabScreenContents(_scratch, format, 0, 0, width, height); // send the buffer to the exportable object for processing. exportable.export(_scratch, width, height); } }