Пример #1
0
void BasicApp::setup()
{	
	gl::enable( GL_TEXTURE_2D );
	
	mFrameRate	= 0.0f;
	mFullScreen	= false;

	mDevice = Kinect2::Device::create();
	mDevice->start();
	mDevice->connectBodyIndexEventHandler( [ & ]( const Kinect2::BodyIndexFrame& frame )
	{
		mChannelBodyIndex = frame.getChannel();
	} );
	mDevice->connectColorEventHandler( [ & ]( const Kinect2::ColorFrame& frame )
	{
		mSurfaceColor = frame.getSurface();
	} );
	mDevice->connectDepthEventHandler( [ & ]( const Kinect2::DepthFrame& frame )
	{
		mChannelDepth = frame.getChannel();
	} );
	mDevice->connectInfraredEventHandler( [ & ]( const Kinect2::InfraredFrame& frame )
	{
		mChannelInfrared = frame.getChannel();
	} );
	
	mParams = params::InterfaceGl::create( "Params", ivec2( 200, 100 ) );
	mParams->addParam( "Frame rate",	&mFrameRate,			"", true );
	mParams->addParam( "Full screen",	&mFullScreen ).key( "f" );
	mParams->addButton( "Quit",			[ & ]() { quit(); } ,	"key=q" );
}
Пример #2
0
void _TBOX_PREFIX_App::setup()
{	
	mDevice = Kinect2::Device::create();
	mDevice->start();
	mDevice->connectDepthEventHandler( [ & ]( const Kinect2::DepthFrame& frame )
	{
		mChannel = frame.getChannel();
	} );
}
Пример #3
0
void PointCloudApp::setup()
{
    mCamUi = CameraUi(&mCam);

	gl::enable( GL_TEXTURE_2D );
	
	mFrameRate		= 0.0f;
	mFullScreen		= false;
	mTimeStamp		= 0L;
	mTimeStampPrev	= mTimeStamp;
	
	loadGlsl();

	mDevice = Kinect2::Device::create();
	mDevice->start();
	mDevice->connectColorEventHandler( [ & ]( const Kinect2::ColorFrame& frame )
	{
		mSurfaceColor	= frame.getSurface();
	} );
	mDevice->connectDepthEventHandler( [ & ]( const Kinect2::DepthFrame& frame )
	{
		mChannelDepth	= frame.getChannel();
		mTimeStamp		= frame.getTimeStamp();
	} );

	//////////////////////////////////////////////////////////////////////////////////////////////

	ivec2 sz = Kinect2::DepthFrame().getSize();
	vector<vec2> vertices;
	for ( int32_t x = 0; x < sz.x; ++x ) {
		for ( int32_t y = 0; y < sz.y; ++y ) {
			vertices.push_back( vec2( x, y ) / vec2( sz ) );
		}
	}

	gl::VboRef vbo = gl::Vbo::create( GL_ARRAY_BUFFER, vertices.size() * sizeof( vec2 ), &vertices[ 0 ], GL_STATIC_DRAW );

	geom::BufferLayout layout;
	layout.append( geom::Attrib::POSITION, 2, sizeof( vec2 ), 0 );
	vector<pair<geom::BufferLayout, gl::VboRef>> vertexArrayBuffers = { make_pair( layout, vbo ) };

	mVboMesh = gl::VboMesh::create( vertices.size(), GL_POINTS, vertexArrayBuffers );

	//////////////////////////////////////////////////////////////////////////////////////////////
	
	mParams = params::InterfaceGl::create( "Params", ivec2( 200, 120 ) );
	mParams->addParam( "Frame rate",	&mFrameRate,				"", true );
	mParams->addParam( "Full screen",	&mFullScreen ).key( "f" );
	mParams->addButton( "Load GLSL",	[ & ]() { loadGlsl(); },	"key=g" );
	mParams->addButton( "Quit",			[ & ]() { quit(); },		"key=q" );

	resize();
}