コード例 #1
0
void LeapPalmDirectionApp::update()
{
	if ( mLeap && mLeap->isConnected() )
	{
		mLeap->update();
	}
}
コード例 #2
0
ファイル: LeapApp.cpp プロジェクト: gaborpapp/Cinder-LeapSdk
// Runs update logic
void LeapApp::update()
{
	// Update frame rate
	mFrameRate = getAverageFps();

	// Toggle fullscreen
	if ( mFullScreen != isFullScreen() ) {
		setFullScreen( mFullScreen );
	}

	// Update device
	if ( mLeap && mLeap->isConnected() ) {		
		mLeap->update();
	}
}
コード例 #3
0
ファイル: LeapApp.cpp プロジェクト: gaborpapp/Cinder-LeapSdk
// Set up
void LeapApp::setup()
{
	// Set up OpenGL
	gl::enable( GL_LINE_SMOOTH );
	glHint( GL_LINE_SMOOTH_HINT, GL_NICEST ); 
	gl::enable( GL_POLYGON_SMOOTH );
	glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );

	// Set up camera
	mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
	mCamera.lookAt( Vec3f( 0.0f, 125.0f, 500.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
	
	// Start device
	mLeap = Device::create();
	mLeap->addCallback( &LeapApp::onFrame, this );

	// Params
	mFrameRate	= 0.0f;
	mFullScreen	= false;
	mParams = params::InterfaceGl( "Params", Vec2i( 200, 105 ) );
	mParams.addParam( "Frame rate",		&mFrameRate,						"", true );
	mParams.addParam( "Full screen",	&mFullScreen,						"key=f"		);
	mParams.addButton( "Screen shot",	bind( &LeapApp::screenShot, this ), "key=space" );
	mParams.addButton( "Quit",			bind( &LeapApp::quit, this ),		"key=q" );
}
コード例 #4
0
ファイル: ChargesApp.cpp プロジェクト: gaborpapp/apps
void ChargesApp::shutdown()
{
	mndl::kit::params::PInterfaceGl::save();

	mEffectCharge.deinstantiate();
	mLeap->removeCallback( mLeapCallbackId );
}
コード例 #5
0
ファイル: ChargesApp.cpp プロジェクト: gaborpapp/apps
void ChargesApp::setup()
{
	//gl::disableVerticalSync();

	gl::Fbo::Format format;
	format.enableDepthBuffer( false );
	format.setSamples( 4 );

	mFbo = gl::Fbo( 1280, 800, format );
	mKawaseBloom = mndl::gl::fx::KawaseBloom( mFbo.getWidth(), mFbo.getHeight() );

	mEffectCharge.setup();
	mEffectCharge.instantiate();
	mEffectCharge.setBounds( mFbo.getBounds() );

	// Leap
	mLeap = LeapSdk::Device::create();
	mLeapCallbackId = mLeap->addCallback( &ChargesApp::onFrame, this );

	// params
	mndl::kit::params::PInterfaceGl::load( "params.xml" );
	mParams = mndl::kit::params::PInterfaceGl( "Parameters", Vec2i( 200, 300 ) );
	mParams.addPersistentSizeAndPosition();
	mParams.addParam( "Fps", &mFps, "", true );
	mParams.addSeparator();
	mParams.addPersistentParam( "Line width", &mLineWidth, 4.5f, "min=.5 max=10 step=.1" );
	mParams.addPersistentParam( "Bloom strength", &mBloomStrength, .8f, "min=0 max=1 step=.05" );
	mParams.addPersistentParam( "Finger disapperance thr", &mFingerDisapperanceThreshold, .1f, "min=0 max=2 step=.05" );

	mndl::kit::params::PInterfaceGl::showAllParams( false );
}
コード例 #6
0
void LeapPalmDirectionApp::setup()
{
	mLeap = LeapSdk::Device::create();
	mCallbackId = mLeap->addCallback( &LeapPalmDirectionApp::onFrame, this );

	mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
	mCamera.lookAt( Vec3f( 0.0f, 250.0f, 500.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
}
コード例 #7
0
// Maps pointable's ray to the screen in pixels
Vec2f GestureApp::warpPointable( const Pointable& p )
{
	Vec3f result = Vec3f::zero();
	if ( mLeap ) {
		const Screen& screen = mLeap->getClosestScreen( p );
		if ( screen.intersects( p, &result, true ) ) {
			result		*= Vec3f( Vec2f( getWindowSize() ), 0.0f );
			result.y	= (float)getWindowHeight() - result.y;
		}
	}
	return result.xy();
}
コード例 #8
0
ファイル: BrainbowApp.cpp プロジェクト: JAGormley/Brainbow
void BrainbowApp::update()
{
    //LEAP
    if ( mLeap && mLeap->isConnected() ) {
		mLeap->update();
	}
    //GET HAND
    for ( LeapSdk::HandMap::const_iterator handIter = mHands.begin(); handIter != mHands.end(); ++handIter ) {
		const LeapSdk::Hand& hand = handIter->second;
        //        cout << hand.getPosition().x << endl;
        //        cout << hand.getDirection();
        
        scaledX = (hand.getPosition().x *(getWindowWidth()/400))+(getWindowWidth()/2);
        scaledY = (-hand.getPosition().y*(getWindowHeight()/400) + getWindowHeight())*2.5 - 400;
        scaledZ = hand.getPosition().z*2+300;
        handPos = Vec3f(scaledX, scaledY, scaledZ);
    }
    
    //AUDIO
    //    mAudio.update();
    
    
    //SCENES
    if (sceneOne)
        scene1();
    if (sceneTwo)
        scene2();
    
    
    //LIGHT
    
    mLight->lookAt( handPos, Vec3f::zero() );
    
    //ROTATE DIAMOND
    if (gong)
        mDiamond.getModelMatrix().rotate( Vec3f( 0.0f, 0.5f, 0), 0.01f );

    
}
コード例 #9
0
// Maps Leap vector to the screen in pixels
Vec2f GestureApp::warpVector( const Vec3f& v )
{
	Vec3f result = Vec3f::zero();
	if ( mLeap ) {
		const ScreenMap& screens = mLeap->getScreens();
		if ( !screens.empty() ) {
			const Screen& screen = screens.begin()->second;
			result = screen.project( v, true );
		}
	}
	result *= Vec3f( getWindowSize(), 0.0f );
	result.y = (float)getWindowHeight() - result.y;
	return result.xy();
}
コード例 #10
0
void _TBOX_PREFIX_App::setup()
{	 
	// Set up OpenGL
	gl::enableAlphaBlending();
	gl::enableDepthRead();
	gl::enableDepthWrite();
	
	// Set up camera
	mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
	mCamera.lookAt( Vec3f( 0.0f, 125.0f, 500.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
	
	// Start device
	mLeap 		= LeapSdk::Device::create();
	mCallbackId = mLeap->addCallback( &_TBOX_PREFIX_App::onFrame, this );
}
コード例 #11
0
// Set up
void GestureApp::setup()
{
	// Set up OpenGL
	gl::enable( GL_POLYGON_SMOOTH );
	glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
	
	// UI
	mBackgroundBrightness	= 0.0f;
	mBackgroundColor		= Colorf( 0.0f, 0.1f, 0.2f );
	mCircleResolution		= 32;
	mDialBrightness			= 0.0f;
	mDialPosition			= Vec2f( 155.0f, 230.0f );
	mDialRadius				= 120.0f;
	mDialSpeed				= 0.21f;
	mDialValue				= 0.0f;
	mDialValueDest			= mDialValue;
	mDotRadius				= 3.0f;
	mDotSpacing				= mDotRadius * 3.0f;
	mFadeSpeed				= 0.95f;
	mKeySpacing				= 25.0f;
	mKeyRect				= Rectf( mKeySpacing, 360.0f + mKeySpacing, 600.0f, 600.0f );
	mKeySize				= 60.0f;
	mPointableRadius		= 15.0f;
	mSwipeBrightness		= 0.0f;
	mSwipePos				= 0.0f;
	mSwipePosDest			= mSwipePos;
	mSwipePosSpeed			= 0.33f;
	mSwipeRect				= Rectf( 310.0f, 100.0f, 595.0f, 360.0f );
	mSwipeStep				= 0.033f;
	
	// Sets master offset
	resize();
	
	// Lay out keys
	float spacing = mKeySize + mKeySpacing;
	for ( float y = mKeyRect.y1; y < mKeyRect.y2; y += spacing ) {
		for ( float x = mKeyRect.x1; x < mKeyRect.x2; x += spacing ) {
			Rectf bounds( x, y, x + mKeySize, y + mKeySize );
			Key key( bounds );
			mKeys.push_back( key );
		}
	}
	
	// Start device
	mLeap 		= Device::create();
	mCallbackId = mLeap->addCallback( &GestureApp::onFrame, this );

	// Enable all gesture types
	mLeap->enableGesture( Gesture::Type::TYPE_CIRCLE );
	mLeap->enableGesture( Gesture::Type::TYPE_KEY_TAP );
	mLeap->enableGesture( Gesture::Type::TYPE_SCREEN_TAP );
	mLeap->enableGesture( Gesture::Type::TYPE_SWIPE );
	
	// Params
	mFrameRate	= 0.0f;
	mFullScreen	= false;
	mParams = params::InterfaceGl( "Params", Vec2i( 200, 105 ) );
	mParams.addParam( "Frame rate",		&mFrameRate,						"", true );
	mParams.addParam( "Full screen",	&mFullScreen,						"key=f"		);
	mParams.addButton( "Screen shot",	bind( &GestureApp::screenShot, this ), "key=space" );
	mParams.addButton( "Quit",			bind( &GestureApp::quit, this ),		"key=q" );
}
コード例 #12
0
ファイル: BrainbowApp.cpp プロジェクト: JAGormley/Brainbow
void BrainbowApp::shutdown()
{
	mLeap->removeCallback( mCallbackId );
	mHands.clear();
}
コード例 #13
0
ファイル: BrainbowApp.cpp プロジェクト: JAGormley/Brainbow
void BrainbowApp::setup()
{
    // LOAD AUDIO
    mAudio = AudioCont();
    mAudio.setUp();
    
    // START SCENE 1
    sceneOne = true;
    sceneTwo = false;
    
    // Set up OpenGL
    
	gl::enableAlphaBlending();
	gl::enableDepthRead();
	gl::enableDepthWrite();
    
    gongTimer.start();
    ballTimer.start();
    
    // LIGHTING
    //here
    glPolygonOffset( 1.0f, 1.0f );
	glEnable( GL_LIGHTING );
	glEnable( GL_DEPTH_TEST );
    
    
    mLight = new gl::Light( gl::Light::POINT, 0 );
	mLight->lookAt( Vec3f( 1, 5, 1 ), Vec3f (getWindowWidth(), getWindowHeight() * 0.5f, 0.0f ));
    mLight->setAmbient( Color( 0.3f, 0.3f, 0.3f ) );
	mLight->setDiffuse( Color( 1.0f, 1.0f, 1.0f ) );
	mLight->setSpecular( Color( 1.0f, 1.0f, 1.0f ) );
	mLight->setShadowParams( 60.0f, 0.5f, 8.0f );
    //	mLight->update( *mCamera );
	mLight->enable();
    
    
    //LOAD SHAPES
    colorSat = 1.0f;
    
	sphereMaterial.setSpecular( ColorA(colorSat-0.3f, colorSat, colorSat, .4f ) );
	sphereMaterial.setDiffuse( ColorA(colorSat-0.3f, colorSat, colorSat, .4f ) );
	sphereMaterial.setAmbient( ColorA(colorSat-0.3f, colorSat, colorSat, .05f ) );
	sphereMaterial.setShininess( 1.0f );
    
    sphereMaterial.setEmission(ColorA(1, 1, 1, 1 ));
    gl::Material cylMaterial;
    cylMaterial.setSpecular( ColorA(0, 1.0f, 1.0f, .2f ));
	cylMaterial.setDiffuse( ColorA(0, 1.0f, 1.0f, .2f ) );
	cylMaterial.setAmbient( ColorA(0, 1.0f, 1.0f, .2f ) );
	cylMaterial.setShininess( 600.0f );
    cylMaterial.setEmission(ColorA(1, 1, 1, 1 ));
    
    gl::Material curMaterial;
    curMaterial.setSpecular( ColorA(1, .5, 0, .5f ));
	curMaterial.setDiffuse( ColorA(1, .5, 0, .5f ) );
	curMaterial.setAmbient( ColorA(1, 1.0f, 1.0f, .05f ) );
	curMaterial.setShininess( 600.0f );
    curMaterial.setEmission(ColorA(1, 1, 1, 1 ));
    
    
	discMaterial.setSpecular( ColorA(colorSat-0.3f, colorSat, colorSat, .4f ) );
	discMaterial.setDiffuse( ColorA(colorSat-0.3f, colorSat, colorSat, .4f ) );
	discMaterial.setAmbient( ColorA(colorSat-0.3f, colorSat, colorSat, .05f ) );
	discMaterial.setShininess( 600.0f );
    discMaterial.setEmission(ColorA(1, 1, 1, 1 ));
    
    initShadowMap();
    
    mCloud = SphereCloud(0, 70);
    
    mDiamond = gl::DisplayList( GL_COMPILE );
    mDiamond.newList();
    gl::drawSphere(Vec3f(0, 0, 0), 300, 4);
    mDiamond.endList();
    mDiamond.setMaterial( sphereMaterial );
    
    mCyl = gl::DisplayList( GL_COMPILE );
    mCyl.newList();
    //    gl::drawCylinder(200, 200, 200);
    gl::drawColorCube(Vec3f(0, 0, 0), Vec3f(300, 300, 300));
    mCyl.endList();
    mCyl.setMaterial(cylMaterial);
    
    mCur = gl::DisplayList( GL_COMPILE );
    mCur.newList();
    gl::drawSphere(Vec3f(0, 0, 0), 5);
    mCur.endList();
    mCur.setMaterial(curMaterial);
    
    mDisc = gl::DisplayList( GL_COMPILE );
    mDisc.newList();
    gl::drawSolidCircle(Vec2f(0, 0), 60, 6);
    mDisc.endList();
    mDisc.setMaterial( discMaterial );
	
	// START LEAP
	mLeap 		= LeapSdk::Device::create();
	mCallbackId = mLeap->addCallback( &BrainbowApp::onFrame, this );
    
    
    mShader = gl::GlslProg( loadResource( RES_SHADOWMAP_VERT ), loadResource( RES_SHADOWMAP_FRAG ) );
	mShader.bind();
	mShader.uniform( "depthTexture", 0 );
}
コード例 #14
0
// Runs update logic
void GestureApp::update()
{
	// Update frame rate
	mFrameRate = getAverageFps();

	// Toggle fullscreen
	if ( mFullScreen != isFullScreen() ) {
		setFullScreen( mFullScreen );
	}

	// Update device
	if ( mLeap && mLeap->isConnected() ) {		
		mLeap->update();
	}
	
	const vector<Leap::Gesture>& gestures = mFrame.getGestures();
	for ( vector<Leap::Gesture>::const_iterator iter = gestures.begin(); iter != gestures.end(); ++iter ) {
		Gesture::Type type = iter->type();
		if ( type == Gesture::Type::TYPE_CIRCLE ) {
			
			// Cast to circle gesture
			const Leap::CircleGesture& gesture = (Leap::CircleGesture)*iter;
			
			// Control dial
			mDialBrightness	= 1.0f;
			mDialValueDest	= gesture.progress();
			
		} else if ( type == Gesture::Type::TYPE_KEY_TAP ) {
			
			// Cast to circle gesture and read data
			const Leap::KeyTapGesture& gesture = (Leap::KeyTapGesture)*iter;
			Vec2f center	= warpVector( fromLeapVector( gesture.position() ) );
			center			-= mOffset;
			
			// Press key
			for ( vector<Key>::iterator iter = mKeys.begin(); iter != mKeys.end(); ++iter ) {
				if ( iter->mBounds.contains( center ) ) {
					iter->mBrightness = 1.0f;
					break;
				}
			}
			
		} else if ( type == Gesture::Type::TYPE_SCREEN_TAP ) {
			
			// Turn background white for screen tap
			mBackgroundBrightness = 1.0f;
			
		} else if ( type == Gesture::Type::TYPE_SWIPE ) {
			
			// Cast to swipe gesture and read data
			const Leap::SwipeGesture& gesture = (Leap::SwipeGesture)*iter;
			ci::Vec2f a	= warpVector( fromLeapVector( gesture.startPosition() ) );
			ci::Vec2f b	= warpVector( fromLeapVector( gesture.position() ) );
			
			// Update swipe position
			mSwipeBrightness	= 1.0f;
			if ( gesture.state() == Gesture::State::STATE_STOP ) {
				mSwipePosDest	= b.x < a.x ? 0.0f : 1.0f;
			} else {
				float step		= mSwipeStep;
				mSwipePosDest	+= b.x < a.x ? -step : step;
			}
			mSwipePosDest		= math<float>::clamp( mSwipePosDest, 0.0f, 1.0f );
		}
	}
	
	// UI animation
	mDialValue				= lerp( mDialValue, mDialValueDest, mDialSpeed );
	mSwipePos				= lerp( mSwipePos, mSwipePosDest, mSwipePosSpeed );
	mBackgroundBrightness	*= mFadeSpeed;
	mDialBrightness			*= mFadeSpeed;
	mSwipeBrightness		*= mFadeSpeed;
	for ( vector<Key>::iterator iter = mKeys.begin(); iter != mKeys.end(); ++iter ) {
		iter->mBrightness *= mFadeSpeed;
	}
}
コード例 #15
0
ファイル: ChargesApp.cpp プロジェクト: gaborpapp/apps
void ChargesApp::update()
{
	mFps = getAverageFps();

	// Update device
	if ( mLeap && mLeap->isConnected() )
	{
		mLeap->update();
	}

	vector< int32_t > currentFingersIds;

	for ( const std::pair< int32_t, LeapSdk::Hand > hand : mHands )
	{
		const LeapSdk::FingerMap &fingers = hand.second.getFingers();
		for ( const auto &fkv : fingers )
		{
			int32_t id = fkv.first;
			const LeapSdk::Finger &finger = fkv.second;

			currentFingersIds.push_back( id );

			// new finger?
			if ( mActiveFingers.find( id ) == mActiveFingers.end() )
			{
				mActiveFingers[ id ] = mTimestamp;
				mEffectCharge.addCursor( id, 0.f, 0.f, 1.f ); // init with (0, 0), will be updated below
			}

			// update finger
			const LeapSdk::ScreenMap &screens = mLeap->getScreens();
			if ( screens.begin() != screens.end() )
			{
				mActiveFingers[ id ] = mTimestamp;

				const LeapSdk::Screen &screen = screens.begin()->second;
				Vec3f normPos;
				screen.intersects( finger, normPos, true, 1.5f ); // normalized screen coordinates with 1.5 clamp ratio
				Vec2f fingertip = normPos.xy() * Vec2f( mFbo.getSize() );

				Vec3f screenPos;
				screen.intersects( finger, screenPos, false, 1.5f ); // screen coordinates with 1.5 clamp ratio
				float d = screenPos.distance( finger.getPosition() );
				const float dMin = 50.f;
				const float dMax = 500.f;
				const float sMin = 1.f;
				const float sMax = 100.f;
				d = math< float >::clamp( d, dMin, dMax );
				float strength = lmap( d, dMin, dMax, sMax, sMin );

				mEffectCharge.updateCursor( id, fingertip.x, fingertip.y, strength );
			}
		}
	}

	// erase disappeared fingers
	int64_t disappearThr = mFingerDisapperanceThreshold * 1000000;
	for ( auto it = mActiveFingers.begin(); it != mActiveFingers.end(); )
	{
		int32_t id = it->first;
		if ( find( currentFingersIds.begin(), currentFingersIds.end(), id ) == currentFingersIds.end() )
		{
			// seen earlier than the threshold?
			if ( mTimestamp - it->second > disappearThr )
			{
				mEffectCharge.removeCursor( id );
				it = mActiveFingers.erase( it );
			}
			else
			{
				it++;
			}
		}
		else
		{
			it++;
		}
	}
}
コード例 #16
0
void _TBOX_PREFIX_App::shutdown()
{
	mLeap->removeCallback( mCallbackId );
	mHands.clear();
}
コード例 #17
0
ファイル: UiApp.cpp プロジェクト: gaborpapp/Cinder-LeapSdk
// Runs update logic
void UiApp::update()
{
	// Update frame rate
	mFrameRate = getAverageFps();

	// Toggle fullscreen
	if ( mFullScreen != isFullScreen() ) {
		setFullScreen( mFullScreen );
	}

	// Update device
	if ( mLeap && mLeap->isConnected() ) {		
		mLeap->update();
	}
	
	// Interact with first hand
	if ( mHands.empty() ) {
		mCursorType		= CursorType::NONE;
	} else {
		const Hand& hand = mHands.begin()->second;
		
		// Update cursor position
		mCursorPositionTarget	= warp( hand.getPosition() );
		if ( mCursorType == CursorType::NONE ) {
			mCursorPosition = mCursorPositionTarget;
		}
		
		// Choose cursor type based on number of exposed fingers
		switch ( hand.getFingers().size() ) {
			case 0:
				mCursorType	= CursorType::GRAB;
				break;
			case 1:
				mCursorType	= CursorType::TOUCH;
				break;
			default:
				mCursorType	= CursorType::HAND;
				break;
		}
	}
	
	// Smooth cursor animation
	mCursorPosition = mCursorPosition.lerp( 0.21f, mCursorPositionTarget );
	mCursorPosition.z = 0.0f;
	
	// Hit buttons
	for ( size_t i = 0; i < 3; ++i ) {
		mButtonState[ i ] = false;
		if ( mCursorType == CursorType::TOUCH &&
			mCursorPosition.distance( mButtonPosition[ i ] ) < (float)mButton[ 0 ].getSize().length() * 0.5f ) {
			mButtonState[ i ] = true;
		}
	}
	
	// Slider
	if ( mCursorType == CursorType::GRAB &&
		math<float>::abs( mCursorPosition.x - mSliderPosition.x ) < (float)mSlider.getWidth() * 0.5f &&
		math<float>::abs( mCursorPosition.y - mSliderPosition.y ) < (float)mSlider.getHeight() * 0.5f ) {
		float x1			= mTrackPosition.x;
		float x2			= mTrackPosition.x + (float)( mTrack.getWidth() - mSlider.getWidth() );
		mSliderPosition.x	= math<float>::clamp( mCursorPosition.x, x1, x2 );
	}
}
コード例 #18
0
ファイル: UiApp.cpp プロジェクト: gaborpapp/Cinder-LeapSdk
// Set up
void UiApp::setup()
{
	glShadeModel( GL_FLAT );
	
	// Set up camera
	mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 45.0f, 0.01f, 1000.0f );
	mOffset = Vec3f( 240.0f, -480.0f, 0.0f );
	
	// Start device
	mLeap = Device::create();
	mLeap->addCallback( &UiApp::onFrame, this );
	
	// Load cursor textures
	for ( size_t i = 0; i < 3; ++i ) {
		switch ( (CursorType)i ) {
			case CursorType::GRAB:
				mTexture[ i ] = gl::Texture( loadImage( loadResource( RES_TEX_GRAB ) ) );
				break;
			case CursorType::HAND:
				mTexture[ i ] = gl::Texture( loadImage( loadResource( RES_TEX_HAND ) ) );
				break;
			case CursorType::TOUCH:
				mTexture[ i ] = gl::Texture( loadImage( loadResource( RES_TEX_TOUCH ) ) );
				break;
			case NONE:
				break;
		}
		mTexture[ i ].setFlipped( true );
		mTexture[ i ].setMagFilter( GL_NEAREST );
		mTexture[ i ].setMinFilter( GL_NEAREST );
	}
	
	// Initialize cursor
	mCursorType				= CursorType::NONE;
	mCursorPosition			= Vec3f::zero();
	mCursorPositionTarget	= Vec3f::zero();
	
	// Load UI textures
	mButton[ 0 ]	= gl::Texture( loadImage( loadResource( RES_TEX_BUTTON_OFF ) ) );
	mButton[ 1 ]	= gl::Texture( loadImage( loadResource( RES_TEX_BUTTON_ON ) ) );
	mSlider			= gl::Texture( loadImage( loadResource( RES_TEX_SLIDER ) ) );
	mTrack			= gl::Texture( loadImage( loadResource( RES_TEX_TRACK ) ) );

	// Flip textures
	mButton[ 0 ].setFlipped( true );
	mButton[ 1 ].setFlipped( true );
	mSlider.setFlipped( true );
	mTrack.setFlipped( true );
	
	// Disable anti-aliasing
	mButton[ 0 ].setMagFilter( GL_NEAREST );
	mButton[ 0 ].setMinFilter( GL_NEAREST );
	mButton[ 1 ].setMagFilter( GL_NEAREST );
	mButton[ 1 ].setMinFilter( GL_NEAREST );
	mSlider.setMagFilter( GL_NEAREST );
	mSlider.setMinFilter( GL_NEAREST );
	mTrack.setMagFilter( GL_NEAREST );
	mTrack.setMinFilter( GL_NEAREST );
	
	// Initialize buttons
	Vec3f position( -120.0f, 950.0f, 0.0f );
	for ( size_t i = 0; i < 3; ++i, position.x += 320.0f ) {
		mButtonPosition[ i ]	= position;
		mButtonState[ i ]		= false;
	}
	
	// Initialize sliider
	mTrackPosition		= Vec3f( 0.0f, 700.0f, 0.0f );
	mSliderPosition		= mTrackPosition;
	mSliderPosition.y	-= 45.0f;
	
	// Params
	mFrameRate	= 0.0f;
	mFullScreen	= false;
	mParams = params::InterfaceGl( "Params", Vec2i( 200, 105 ) );
	mParams.addParam( "Frame rate",		&mFrameRate,						"", true );
	mParams.addParam( "Full screen",	&mFullScreen,						"key=f"		);
	mParams.addButton( "Screen shot",	bind( &UiApp::screenShot, this ),	"key=space" );
	mParams.addButton( "Quit",			bind( &UiApp::quit, this ),			"key=q" );
}
コード例 #19
0
// Quit
void GestureApp::shutdown()
{
	mLeap->removeCallback( mCallbackId );
}
コード例 #20
0
void _TBOX_PREFIX_App::update()
{	 
	if ( mLeap && mLeap->isConnected() ) {		
		mLeap->update();
	}
}
コード例 #21
0
void LeapPalmDirectionApp::shutdown()
{
	mLeap->removeCallback( mCallbackId );
	mHands.clear();
}