void SyphonBasicApp::setup() { try { mLogo = gl::Texture::create( loadImage( loadAsset("cinder_logo_alpha.png") ) ); } catch( ... ) { std::cout << "unable to load the texture file!" << std::endl; } try { mShader = gl::GlslProg::create( loadAsset("passThru_vert.glsl"), loadAsset("gaussianBlur_frag.glsl") ); } catch( gl::GlslProgCompileExc &exc ) { std::cout << "Shader compile error: " << std::endl; std::cout << exc.what(); } catch( ... ) { std::cout << "Unable to load shader" << std::endl; } mAngle = 0.0f; mScreenSyphon.setName("Screen Output"); // set a name for each item to be published mTextureSyphon.setName("Texture Output"); mClientSyphon.setup(); // in order for this to work, you must run simple server which is a syphon test application // feel free to change the app and server name for your specific case mClientSyphon.set("", "Simple Server"); mClientSyphon.bind(); }
void MilluminApp::setup() { listener.setup(5001); host = "127.0.0.1"; port = 5000; sender.setup(host, port); mTex = gl::Texture(200, 100); //create our texture to publish mSurface = Surface8u(200, 100, false); //create a surface to manipulate randomizeSurface(&mSurface); //randomize our surface mTex.update(mSurface); //tell the texture about our changes archimedes.set(100.f, 0.6f); //set up and calculate our spiral archimedes.calc(); mRot = 0.f; mScreenSyphon.setName("Cinder Screen"); // set a name for each item to be published mTextureSyphon.setName("Cinder Texture"); mClientSyphon.setup(); // in order for this to work, you must run simple server from the testapps directory // any other syphon item you create would work as well, just change the name mClientSyphon.setApplicationName("Simple Server"); mClientSyphon.setServerName(""); mClientSyphon.bind(); }
void AwesomeSilkApp::setup() { setWindowPos(Vec2i(100,200)); // set Awesomium logging to verbose Awesomium::WebConfig cnf; cnf.log_level = Awesomium::kLogLevel_Verbose; #if defined( CINDER_MAC ) std::string frameworkPath = ( getAppPath() / "Contents" / "MacOS" ).string(); cnf.package_path = Awesomium::WebString::CreateFromUTF8( frameworkPath.c_str(), frameworkPath.size() ); #endif // initialize the Awesomium web engine mWebCorePtr = Awesomium::WebCore::Initialize( cnf ); // create a webview mWebViewPtr = mWebCorePtr->CreateWebView( getWindowWidth(), getWindowHeight() ); mWebViewPtr->LoadURL( Awesomium::WebURL( Awesomium::WSLit( "http://localhost/~vgusev/silk/silk/WebContent/silk.html" ) ) ); mWebViewPtr->Focus(); // load and create a "loading" icon try { mLoadingTexture = gl::Texture( loadImage( loadAsset( "loading.png" ) ) ); } catch( const std::exception &e ) { console() << "Error loading asset: " << e.what() << std::endl; } DialogWebViewListener *listener = new DialogWebViewListener(); mWebViewPtr->set_dialog_listener(listener); mTextureSyphon.setName("Cinder Texture"); useSyphon = false; }
void BBPulseApp::setup() { mFrequency = 440.0f; mPhase = 0.0f; mPhaseAdd = 0.0f; mModFrequency = 0.0f; mModPhase = 0.0f; mModPhaseAdd = 0.0f; audio::Output::play( audio::createCallback( this, &BBPulseApp::audioCallback ) ); mDelay = 200; mMix = 0.2f; mFeedback = 0.3f; mDelaySize = mDelay * 44.1f; for( int i=0; i<mDelaySize; i++ ){ mDelayLine.push_back( 0.0f ); } mDelayIndex = 0; BBPulseSyphon.setName("BBSyphon Screen"); }
void ardroneApp::setup() { setupMovie(); mSyphonServer.setName("ffmpeg-to-syphon"); getWindow()->setTitle("eight_io: ffmpeg-to-syphon"); renderFbo = gl::Fbo( getWindowWidth(), getWindowHeight() ); }
void ardroneApp::setup() { setupMovie(); mSyphonServer.setName("ffmpeg-to-syphon"); getWindow()->setTitle("eight_io: ffmpeg-to-syphon"); renderFbo = gl::Fbo( getWindowWidth(), getWindowHeight() ); drone.connect(); // setup command history lengths for debugging and dumping onscreen (OPTIONAL) drone.controller.commandHistory.setMaxLength(30); drone.dataReceiver.commandHistory.setMaxLength(30); // setup the simulator so we have a display in the viewport (OPTIONAL) droneSimulator.setup(&drone); }
void EpicMonsterApp::setup() { mScreenSyphon.setName("Epic Monster Demo"); mFallDirection = Vec3f(0.0,-1.0,0.0); listener.setup(7000); // Slows down particle pulses mTimerSlower = 0.05; // Number of iterations for particle drawing to texture n = Vec3f(128, 128, 0); // Where texture baking shader starts drawing (obsolete) mParTexOffset = Vec3f(-1.0, 1.0, 0.0); timer = cinder::Timer(true); mStep = true; try { // Multiple render targets shader updates the positions/velocities mParticlesShader = gl::GlslProg( ci::app::loadResource( PASSTHROUGH_VERT ), ci::app::loadResource( PARTICLES_FRAG )); // Vertex displacement shader mDisplacementShader = gl::GlslProg( ci::app::loadResource( VERTEXDISPLACEMENT_VERT ), ci::app::loadResource( VERTEXDISPLACEMENT_FRAG )); mBakeShader = gl::GlslProg( ci::app::loadResource( BAKE_VERT ), ci::app::loadResource( BAKE_FRAG )); } catch( ci::gl::GlslProgCompileExc &exc ) { std::cout << "Shader compile error: " << endl; std::cout << exc.what(); } catch( const std::exception& ex ) { std::cout << "Unable to load shader" << endl; } setupPingPongFbo(); // THE VBO HAS TO BE DRAWN AFTER FBO! setupVBO(); // End of Particle setup try { mAssimpLoader = assimp::AssimpLoader( getAssetPath( "Monsu7b.dae" ) ); } catch(const std::exception& ex ) { std::cout << "Model loading error: " << endl; std::cout << ex.what(); } mNormalMap = gl::Texture( loadImage( loadResource( RES_NORMAL ) ) ); mAssimpLoader.enableSkinning(); mNodeNames = mAssimpLoader.getNodeNames(); if ( mNodeNames.empty () ) { mNodeNames.push_back( "NO BONES!" ); mNoBones = true; } else { mNoBones = false; } // query original node orientations from model mNodeOrientations.assign( mNodeNames.size(), Quatf() ); if ( !mNoBones ) { for ( size_t i = 0; i < mNodeOrientations.size(); ++i ) { mNodeOrientations[ i ] = mAssimpLoader.getNodeOrientation( mNodeNames[ i ] ); } } // query original node orientations from model mNodePositions.assign( mNodeNames.size(), Vec3f() ); if ( !mNoBones ) { for ( size_t i = 0; i < mNodePositions.size(); ++i ) { mNodePositions[ i ] = mAssimpLoader.getNodePosition( mNodeNames[ i ] ); } } mNodeIndex = 0; triangles = mAssimpLoader.totalTriangles(); mEnableWireframe = false; mEnableDebugTexture = false; mParams = params::InterfaceGl( "Parameters", Vec2i( 200, 300 ) ); setupParams(); CameraPersp cam; cam.setPerspective( 60, getWindowAspectRatio(), 0.1f, 1000.0f ); cam.setEyePoint( Vec3f( 0, 1, 3 ) ); cam.setCenterOfInterestPoint( Vec3f( 0, 0, 0 ) ); mMayaCam.setCurrentCam( cam ); }