void BulletTestApp::setup() { // Set up lighting mLight = new gl::Light( gl::Light::DIRECTIONAL, 0 ); mLight->setDirection( Vec3f( 0.0f, 0.1f, 0.3f ).normalized() ); mLight->setAmbient( ColorAf( 0.2f, 0.2f, 0.2f, 1.0f ) ); mLight->setDiffuse( ColorAf( 1.0f, 1.0f, 1.0f, 1.0f ) ); mLight->enable(); // Load meshes loadModels(); // Create a Bullet dynamics world mWorld = bullet::createWorld(); // Load texture mTexGround = gl::Texture( loadImage( loadResource( RES_TEX_GROUND ))); mTexBackBoard = gl::Texture( loadImage( loadResource( RES_TEX_BACKBOARD ))); mTexRing = gl::Texture( loadImage( loadResource( RES_TEX_RING ))); mTexBasketBall = gl::Texture( loadImage( loadResource( RES_TEX_BASKETBALL ))); // Parameters mFrameRate = 0.0f; mPoint = 0; mViewX = -27; mViewY = -64; mViewZ = 0; mStrengthX = 0; mStrengthY = 44; mStrengthZ = 33; // mStrengthY = 0; // mStrengthZ = 0; mParams = params::InterfaceGl( "Params", Vec2i( 200, 250) ); mParams.addParam( "Frame Rate", &mFrameRate, "", true ); mParams.addParam( "Point" , &mPoint , "", true ); mParams.addText ( "View" ); mParams.addParam( "view_x" , &mViewX, "min=-100 max=100 step=1 keyIncr=7 keyDecr=4" ); mParams.addParam( "view_y" , &mViewY, "min=-100 max=100 step=1 keyIncr=8 keyDecr=5" ); mParams.addParam( "view_z" , &mViewZ, "min=-100 max=100 step=1 keyIncr=9 keyDecr=6" ); mParams.addText ( "Strength" ); mParams.addParam( "strength_x" , &mStrengthX, "min=-100 max=100 step=1 keyIncr=q keyDecr=a" ); mParams.addParam( "strength_y" , &mStrengthY, "min=-100 max=100 step=1 keyIncr=w keyDecr=s" ); mParams.addParam( "strength_z" , &mStrengthZ, "min=-100 max=100 step=1 keyIncr=e keyDecr=d" ); // Initialize initTest(); // Run first resize to initialize view resize( ResizeEvent( getWindowSize() ) ); }
void cinderFFmpegApp::setupGui() { std::stringstream strTmp; m_Gui = ci::params::InterfaceGl("FFmpeg Player", ci::Vec2i(300,340)); // Video / Audio Infos m_Gui.addButton( "open", std::bind( &cinderFFmpegApp::open, this ) ); m_Gui.addButton( "clear all", std::bind( &cinderFFmpegApp::clearAll, this ) ); m_Gui.addSeparator(); strTmp << "label='file: '"; m_Gui.addText("file", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='video codec: '"; m_Gui.addText("video codec", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='audio codec: '"; m_Gui.addText("audio codec", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='width: '"; m_Gui.addText("width", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='height: '"; m_Gui.addText("height", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='fps: '"; m_Gui.addText("fps", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='bitrate: '"; m_Gui.addText("bitrate", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='audio channels: '"; m_Gui.addText("audio channels", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='audio sample rate: '"; m_Gui.addText("audio sample rate", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='frame: '"; m_Gui.addText("frame", strTmp.str()); strTmp.clear(); strTmp.str(""); strTmp << "label='time: '"; m_Gui.addText("time", strTmp.str()); m_Gui.addSeparator(); m_Gui.addButton( "play/pause", std::bind( &cinderFFmpegApp::pause, this ) ); m_Gui.addButton( "stop", std::bind( &cinderFFmpegApp::stop, this ) ); m_Gui.addButton( "toggle direction", std::bind( &cinderFFmpegApp::toggleDirection, this ) ); m_Gui.addSeparator(); m_Gui.addParam("speed", &m_fSpeed, "min=0 max=8.0 step=0.05"); m_Gui.addParam("0..none, 1..loop, 2..loopBidi", &m_iLoopMode, "min=0 max=2 step=1"); m_Gui.addParam("seek frame", &m_fSeekPos, "min=0.0 max=1.0 step=0.01"); }
// Set up void KinectApp::setup() { // Set up OpenGL glLineWidth( 2.0f ); gl::color( ColorAf::white() ); // Set up camera mCamera.lookAt( Vec3f( 0.0f, 0.0f, -3.0f ), Vec3f::zero() ); mCamera.setPerspective( 45.0f, getWindowAspectRatio(), 1.0f, 1000.0f ); // Define drawing body defineBody(); // Initialize parameters mBinaryMode = false; mBinaryModePrev = mBinaryMode; mCapture = true; mCapturePrev = mCapture; mDeviceCount = 0; mEnabledAudio = true; mEnabledAudioPrev = true; mEnabledDepth = true; mEnabledDepthPrev = mEnabledDepth; mEnabledNearMode = false; mEnabledNearModePrev = mEnabledNearMode; mEnabledSkeletons = true; mEnabledSkeletonsPrev = mEnabledSkeletons; mEnabledStats = true; mEnabledVideo = true; mEnabledVideoPrev = mEnabledVideo; mFrameRateApp = 0.0f; mFrameRateDepth = 0.0f; mFrameRateSkeletons = 0.0f; mFrameRateVideo = 0.0f; mFullScreen = isFullScreen(); mInverted = false; mInvertedPrev = mInverted; mRemoveBackground = false; mRemoveBackgroundPrev = mRemoveBackground; mUserCount = 0; // Start image capture startKinect(); // Start audio capture startAudio(); // Setup the parameters mParams = params::InterfaceGl( "Parameters", Vec2i( 245, 500 ) ); mParams.addText( "DEVICE" ); mParams.addParam( "Device count", & mDeviceCount, "", true ); mParams.addParam( "Device angle", & mCameraAngle, "min=-" + toString( Kinect::MAXIMUM_TILT_ANGLE ) + " max=" + toString( Kinect::MAXIMUM_TILT_ANGLE ) + " step=1" ); mParams.addSeparator(); mParams.addText( "STATISTICS"); mParams.addParam( "Collect statistics", & mEnabledStats, "key=t" ); mParams.addParam( "App frame rate", & mFrameRateApp, "", true ); mParams.addParam( "Depth frame rate", & mFrameRateDepth, "", true ); mParams.addParam( "Skeleton frame rate", & mFrameRateSkeletons, "", true ); mParams.addParam( "Video frame rate", & mFrameRateVideo, "", true ); mParams.addParam( "User count", & mUserCount, "", true ); mParams.addSeparator(); mParams.addText( "CAPTURE" ); mParams.addParam( "Capture", & mCapture, "key=c" ); mParams.addParam( "Audio", & mEnabledAudio, "key=a" ); mParams.addParam( "Depth", & mEnabledDepth, "key=d" ); mParams.addParam( "Skeletons", & mEnabledSkeletons, "key=k" ); mParams.addParam( "Video", & mEnabledVideo, "key=v" ); mParams.addSeparator(); mParams.addText( "DEPTH IMAGE"); mParams.addParam( "Remove background", & mRemoveBackground, "key=b" ); mParams.addParam( "Binary depth mode", & mBinaryMode, "key=w" ); mParams.addParam( "Invert binary image", & mInverted, "key=i" ); mParams.addParam( "Near mode", & mEnabledNearMode, "key=n" ); mParams.addSeparator(); mParams.addText( "APPLICATION" ); mParams.addParam( "Full screen", & mFullScreen, "key=f" ); mParams.addButton( "Screen shot", std::bind(& KinectApp::screenShot, this ), "key=s" ); mParams.addButton( "Quit", std::bind( & KinectApp::quit, this ), "key=esc" ); }