void BlockOpenNISampleAppApp::update()
{
	if( !V::OpenNIDeviceManager::USE_THREAD )
	{
		_manager->update();
	}


	// Update textures
	mColorTex = getColorImage() ;
	mDepthTex = getDepthImage();
}
void MultipleKinectsApp::setup()
{
    // Init openni and devices
    mManager = V::OpenNIDeviceManager::InstancePtr();
    mManager->createDevices( 1, V::NODE_TYPE_IMAGE | V::NODE_TYPE_DEPTH );

    // Create device 0 is available
    try
    {
        mDevice0 = mManager->getDevice( 0 );
        mDevice0->setDepthShiftMul( 4 );	// scale depth values
        mDevice0->setMirrorMode( V::NODE_TYPE_IMAGE, true );
        mDevice0->setMirrorMode( V::NODE_TYPE_DEPTH, true );
    } catch( std::exception e )
    {
        app::console() << e.what() << std::endl;
    }

    // Create device 1 is available
    try
    {
        mDevice1 = mManager->getDevice( 1 );
        mDevice1->setDepthShiftMul( 4 );
        mDevice1->setMirrorMode( V::NODE_TYPE_IMAGE, true );
        mDevice1->setMirrorMode( V::NODE_TYPE_DEPTH, true );
    } catch( std::exception e )
    {
        app::console() << e.what() << std::endl;
    }

    // Create textures
    mColorTex0 = gl::Texture( KINECT_WIDTH, KINECT_HEIGHT );
    mDepthTex0 = gl::Texture( KINECT_WIDTH, KINECT_HEIGHT );
    mColorTex1 = gl::Texture( KINECT_WIDTH, KINECT_HEIGHT );
    mDepthTex1 = gl::Texture( KINECT_WIDTH, KINECT_HEIGHT );

    mManager->start();

    mPrevTime = mCurrTime = mFrameTime = 0;
}
void BlockOpenNISampleAppApp::setup()
{
	V::OpenNIDeviceManager::USE_THREAD = false;
	_manager = V::OpenNIDeviceManager::InstancePtr();
	_manager->createDevices( 1, V::NODE_TYPE_DEPTH | V::NODE_TYPE_IMAGE, V::RES_1280x1024 );
	_device0 = _manager->getDevice( 0 );
	if( !_device0 ) 
	{
		DEBUG_MESSAGE( "(App)  Can't find a kinect device\n" );
		shutdown();
		quit();
		return;
	}
	_device0->setDepthInvert( false );
	_device0->setDepthShiftMul( 4 );

	mColorTex = gl::Texture( KINECT_COLOR_WIDTH, KINECT_COLOR_HEIGHT );
	mDepthTex = gl::Texture( KINECT_DEPTH_WIDTH, KINECT_DEPTH_HEIGHT );


	//_manager->SetPrimaryBuffer( 0, V::NODE_TYPE_DEPTH );
	_manager->start();
}