本文整理了Java中com.jme3.renderer.Renderer.readFrameBufferWithFormat
方法的一些代码示例,展示了Renderer.readFrameBufferWithFormat
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Renderer.readFrameBufferWithFormat
方法的具体详情如下:
包路径:com.jme3.renderer.Renderer
类名称:Renderer
方法名:readFrameBufferWithFormat
[英]Reads the pixels currently stored in the specified framebuffer into the given ByteBuffer object. Only color pixels are transferred, witht hte given format. The given byte buffer should have at least fb.getWidth() * fb.getHeight() * 4 bytes remaining.
[中]将当前存储在指定帧缓冲区中的像素读取到给定的字节缓冲区对象中。只传输彩色像素,并使用给定的格式。给定的字节缓冲区应该至少有fb。getWidth()*fb。getHeight()*剩余4个字节。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void addImage(Renderer renderer, FrameBuffer out) {
if (freeItems == null) {
return;
}
try {
final WorkItem item = freeItems.take();
usedItems.add(item);
item.buffer.clear();
renderer.readFrameBufferWithFormat(out, item.buffer, Image.Format.BGRA8);
executor.submit(new Callable<Void>() {
public Void call() throws Exception {
Screenshots.convertScreenShot(item.buffer, item.image);
item.data = writer.writeImageToBytes(item.image, quality);
while (usedItems.peek() != item) {
Thread.sleep(1);
}
writer.addImage(item.data);
usedItems.poll();
freeItems.add(item);
return null;
}
});
} catch (InterruptedException ex) {
Logger.getLogger(VideoRecorderAppState.class.getName()).log(Level.SEVERE, null, ex);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void addImage(Renderer renderer, FrameBuffer out) {
if (freeItems == null) {
return;
}
try {
final WorkItem item = freeItems.take();
usedItems.add(item);
item.buffer.clear();
renderer.readFrameBufferWithFormat(out, item.buffer, Image.Format.BGRA8);
executor.submit(new Callable<Void>() {
public Void call() throws Exception {
if (fastMode) {
item.data = item.buffer.array();
} else {
AndroidScreenshots.convertScreenShot(item.buffer, item.image);
item.data = writer.writeImageToBytes(item.image, quality);
}
while (usedItems.peek() != item) {
Thread.sleep(1);
}
writer.addImage(item.data);
usedItems.poll();
freeItems.add(item);
return null;
}
});
} catch (InterruptedException ex) {
Logger.getLogger(VideoRecorderAppState.class.getName()).log(Level.SEVERE, null, ex);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void render(final RenderManager renderManager) {
if (jobs.isEmpty()) {
return;
}
final SnapshotJob job = jobs.get(0);
for (int i = 0; i < 6; i++) {
viewports[i].clearScenes();
viewports[i].attachScene(job.scene);
renderManager.renderViewPort(viewports[i], 0.16f);
buffers[i] = BufferUtils.createByteBuffer(size * size * imageFormat.getBitsPerPixel() / 8);
renderManager.getRenderer().readFrameBufferWithFormat(framebuffers[i], buffers[i], imageFormat);
images[i] = new Image(imageFormat, size, size, buffers[i], ColorSpace.Linear);
MipMapGenerator.generateMipMaps(images[i]);
}
final TextureCubeMap map = EnvMapUtils.makeCubeMap(images[0], images[1], images[2], images[3], images[4], images[5], imageFormat);
debugEnv = map;
job.callback.done(map);
map.getImage().dispose();
jobs.remove(0);
}
代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-desktop
public void addImage(Renderer renderer, FrameBuffer out) {
if (freeItems == null) {
return;
}
try {
final WorkItem item = freeItems.take();
usedItems.add(item);
item.buffer.clear();
renderer.readFrameBufferWithFormat(out, item.buffer, Image.Format.BGRA8);
executor.submit(new Callable<Void>() {
public Void call() throws Exception {
Screenshots.convertScreenShot(item.buffer, item.image);
item.data = writer.writeImageToBytes(item.image, quality);
while (usedItems.peek() != item) {
Thread.sleep(1);
}
writer.addImage(item.data);
usedItems.poll();
freeItems.add(item);
return null;
}
});
} catch (InterruptedException ex) {
Logger.getLogger(VideoRecorderAppState.class.getName()).log(Level.SEVERE, null, ex);
}
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
@Override
public void render(final RenderManager renderManager) {
if (jobs.isEmpty()) {
return;
}
final SnapshotJob job = jobs.get(0);
for (int i = 0; i < 6; i++) {
viewports[i].clearScenes();
viewports[i].attachScene(job.scene);
renderManager.renderViewPort(viewports[i], 0.16f);
buffers[i] = BufferUtils.createByteBuffer(size * size * imageFormat.getBitsPerPixel() / 8);
renderManager.getRenderer().readFrameBufferWithFormat(framebuffers[i], buffers[i], imageFormat);
images[i] = new Image(imageFormat, size, size, buffers[i], ColorSpace.Linear);
MipMapGenerator.generateMipMaps(images[i]);
}
final TextureCubeMap map = EnvMapUtils.makeCubeMap(images[0], images[1], images[2], images[3], images[4], images[5], imageFormat);
debugEnv = map;
job.callback.done(map);
map.getImage().dispose();
jobs.remove(0);
}
内容来源于网络,如有侵权,请联系作者删除!