Exemplo n.º 1
0
void MilluminApp::draw()
{    
	gl::enableAlphaBlending();
	gl::clear( Color( 0.1f, 0.1f, 0.1f ) );

	//draw our spiral
	gl::pushModelView();
	gl::translate(Vec2f(getWindowWidth()/2, getWindowHeight()/2));
	gl::rotate(mRot);
	gl::scale(Vec3f(4.f, 4.f, 1.f));
	gl::color(ColorA(1.f, 0.f, 0.f, 1.f));
	archimedes.draw();
	gl::popModelView();
	
	//draw our publishable texture
	if(mTex){
		gl::color(ColorA(1.f, 1.f, 1.f, 1.f));
		gl::draw(mTex);
	}
	
	mScreenSyphon.publishScreen(); //publish the screen
	mTextureSyphon.publishTexture(&mTex); //publish our texture
	
	//anything that we draw after here will not be published
	
	mClientSyphon.draw(Vec2f(300.0f, 0.0f)); //draw our client image
}
Exemplo n.º 2
0
void SyphonBasicApp::draw()
{
	gl::enableAlphaBlending();
	gl::clear(Color::white());
    gl::color(ColorA(1.f, 1.f, 1.f, 1.f));
	
    mShader->bind();
    mShader->uniform( "tex0", 0 );
    mShader->uniform( "sampleOffset", Vec2f( cos( mAngle ), sin( mAngle ) ) * ( 3.0f / getWindowWidth() ) );
    gl::draw(mLogo, Vec2f::zero());
    mShader->unbind();
    
    mClientSyphon.draw(Vec2f(16.f, 64.f)); //draw our client image
    
	mScreenSyphon.publishScreen(); //publish the screen's output
	mTextureSyphon.publishTexture(mLogo); //publish our texture without shader
	
	//anything that we draw after here will not be published
    gl::drawStringCentered("This text will not be published to Syphon.", Vec2f(getWindowCenter().x, 20.f), ColorA::black());
	
}
Exemplo n.º 3
0
void BBPulseApp::draw()
{
	// clear out the window with black
	gl::clear( Color( 0, 0, 0 ) );
    
    if( mOutput.size() > 0 ){
        Vec2f scale;
        scale.x = (float)getWindowWidth() / (float)mOutput.size();
        scale.y = 100.0f;
        float centerY = getWindowHeight() / 2.0f;
        
        gl::begin( GL_LINE_STRIP );
        for( int i=0; i<mOutput.size(); i++ ){
            float x = (float)i * scale.x;
            float y = mOutput[i] * scale.y + centerY;
            gl::vertex( x,  y );
        }
        
        gl::end();
        BBPulseSyphon.publishScreen();
        
    }
}
void EpicMonsterApp::draw()
{
	gl::clear( Color::black() );
    
	gl::setMatrices( mMayaCam.getCamera() );
    gl::setViewport( getWindowBounds() );
    
    
    
	gl::enableDepthWrite();
	gl::enableDepthRead();
    
	gl::color( Color::white() );
    
	if ( mEnableWireframe )
		gl::enableWireframe();
	gl::Light light( gl::Light::DIRECTIONAL, 0 );
	light.setAmbient( Color::white() );
	light.setDiffuse( Color::white() );
	light.setSpecular( Color::white() );
	light.lookAt( Vec3f( 0, 0, 0 ), Vec3f( 0, 5, 0 ) );
	light.update( mMayaCam.getCamera() );
	light.enable();
    
	gl::enable( GL_LIGHTING );
	gl::enable( GL_NORMALIZE );
    
    mAssimpLoader.draw();
    
    
    mNormalMap.bind( 2 );
    
    mPPFbo.bindTexture(0);
    mPPFbo.bindTexture(1);
    mDisplacementShader.bind();
    mDisplacementShader.uniform("displacementMap", 0 );
    mDisplacementShader.uniform("velocityMap", 1);
    mDisplacementShader.uniform("normalMap", 2);
        mDisplacementShader.uniform("fallDirection", mFallDirection);
    gl::draw( mVboMesh );
    mDisplacementShader.unbind();
    mPPFbo.unbindTexture();
    
    if(mEnableDebugTexture) {
        gl::Texture tex = mPPFbo.getTexture(0);
        //console() << getWindowBounds();
        gl::draw(tex, Rectf(-5.0f, -5.0f, 5.0f, 5.0f));
    }
    
    
	
    //gl::setMatricesWindow(getWindowSize());
    gl::drawString( toString( SIDE*SIDE ) + " vertices", Vec2f(32.0f, 32.0f));
        gl::drawString( toString((int) getAverageFps()) + " fps", Vec2f(32.0f, 52.0f));
    
	gl::disable( GL_LIGHTING );
    
	if ( mEnableWireframe )
		gl::disableWireframe();
    
    mScreenSyphon.publishScreen(); //publish the screen
    
	params::InterfaceGl::draw();
}