us.ihmc.graphics3DAdapter.jme
Class JMEFastCaptureDevice

java.lang.Object
  extended by com.jme3.app.state.AbstractAppState
      extended by us.ihmc.graphics3DAdapter.jme.JMEFastCaptureDevice
All Implemented Interfaces:
com.jme3.app.state.AppState, com.jme3.post.SceneProcessor, CaptureDevice

public class JMEFastCaptureDevice
extends com.jme3.app.state.AbstractAppState
implements com.jme3.post.SceneProcessor, CaptureDevice

Transfer data from GPU to CPU quickly by using two Pixel Buffer Objects (PBO's). Steps taken are First copy the data from the GPU framebuffer to PBO "gpuToVram" (async) Copy the data from PBO "vramToSys" to a byteBuffer Swap gpuToVram and gpuToVram For more information see http://www.songho.ca/opengl/gl_pbo.html http://www.opengl.org/discussion_boards/showthread.php/165780-PBO-glReadPixels-not-so-fast

Author:
jesper

Constructor Summary
JMEFastCaptureDevice(com.jme3.renderer.ViewPort viewport)
           
 
Method Summary
 void cleanup()
           
 void convertScreenShot()
           
 void exportSnapshot(java.io.File snapshotFile)
           
 java.awt.image.BufferedImage exportSnapshotAsBufferedImage()
           
 int getHeight()
           
 int getWidth()
           
 void initialize(com.jme3.app.state.AppStateManager stateManager, com.jme3.app.Application app)
           
 void initialize(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp)
           
 boolean isInitialized()
           
 void postFrame(com.jme3.texture.FrameBuffer out)
           
 void postQueue(com.jme3.renderer.queue.RenderQueue rq)
           
 void preFrame(float tpf)
           
 void reshape(com.jme3.renderer.ViewPort vp, int w, int h)
           
 void setSize(int width, int height)
           
 void streamTo(CameraStreamer cameraStreamer, int framesPerSecond)
           
 
Methods inherited from class com.jme3.app.state.AbstractAppState
isEnabled, postRender, render, setEnabled, stateAttached, stateDetached, update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMEFastCaptureDevice

public JMEFastCaptureDevice(com.jme3.renderer.ViewPort viewport)
Method Detail

initialize

public void initialize(com.jme3.app.state.AppStateManager stateManager,
                       com.jme3.app.Application app)
Specified by:
initialize in interface com.jme3.app.state.AppState
Overrides:
initialize in class com.jme3.app.state.AbstractAppState

initialize

public void initialize(com.jme3.renderer.RenderManager rm,
                       com.jme3.renderer.ViewPort vp)
Specified by:
initialize in interface com.jme3.post.SceneProcessor

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface com.jme3.app.state.AppState
Specified by:
isInitialized in interface com.jme3.post.SceneProcessor
Overrides:
isInitialized in class com.jme3.app.state.AbstractAppState

reshape

public void reshape(com.jme3.renderer.ViewPort vp,
                    int w,
                    int h)
Specified by:
reshape in interface com.jme3.post.SceneProcessor

preFrame

public void preFrame(float tpf)
Specified by:
preFrame in interface com.jme3.post.SceneProcessor

postQueue

public void postQueue(com.jme3.renderer.queue.RenderQueue rq)
Specified by:
postQueue in interface com.jme3.post.SceneProcessor

postFrame

public void postFrame(com.jme3.texture.FrameBuffer out)
Specified by:
postFrame in interface com.jme3.post.SceneProcessor

cleanup

public void cleanup()
Specified by:
cleanup in interface com.jme3.app.state.AppState
Specified by:
cleanup in interface com.jme3.post.SceneProcessor
Overrides:
cleanup in class com.jme3.app.state.AbstractAppState

convertScreenShot

public void convertScreenShot()

exportSnapshotAsBufferedImage

public java.awt.image.BufferedImage exportSnapshotAsBufferedImage()
Specified by:
exportSnapshotAsBufferedImage in interface CaptureDevice

exportSnapshot

public void exportSnapshot(java.io.File snapshotFile)
Specified by:
exportSnapshot in interface CaptureDevice

getHeight

public int getHeight()
Specified by:
getHeight in interface CaptureDevice

getWidth

public int getWidth()
Specified by:
getWidth in interface CaptureDevice

setSize

public void setSize(int width,
                    int height)
Specified by:
setSize in interface CaptureDevice

streamTo

public void streamTo(CameraStreamer cameraStreamer,
                     int framesPerSecond)
Specified by:
streamTo in interface CaptureDevice