void FlickrTestMTApp::draw()
{
	gl::clear( Color( 0.1f, 0.1f, 0.2f ) );

	if( mLastTexture ) {
		gl::color( 1, 1, 1, 1.0f - mFade );
		Rectf textureBounds = mLastTexture->getBounds();
		Rectf drawBounds = textureBounds.getCenteredFit( getWindowBounds(), true );
		gl::draw( mLastTexture, drawBounds );
	}
	if( mTexture ) {
		gl::color( 1, 1, 1, mFade );
		Rectf textureBounds = mTexture->getBounds();
		Rectf drawBounds = textureBounds.getCenteredFit( getWindowBounds(), true );
		gl::draw( mTexture, drawBounds );
	}
}
Exemplo n.º 2
0
void HighDynamicRangeApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) );

	gl::ScopedGlslProg shaderScp( mShader );
	gl::ScopedTextureBind texBindScp( mHdrTexture );
	mShader->uniform( "uExposure", mExposure );
	gl::drawSolidRect( mHdrTexture->getBounds() );
}
Exemplo n.º 3
0
void ImageFileBasicApp::draw()
{
	gl::clear( Color( 0.5f, 0.5f, 0.5f ) );
	gl::enableAlphaBlending();
	
	if( mTexture ) {
		Rectf destRect = Rectf( mTexture->getBounds() ).getCenteredFit( getWindowBounds(), true ).scaledCentered( 0.85f );
		gl::draw(mTexture, getWindowBounds());
	}
	m_params->draw();
}
Exemplo n.º 4
0
void InstascopeApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) );
	gl::enableAlphaBlending( PREMULT );
	
	if( mBgTexture )
		gl::draw( mBgTexture, Rectf( mBgTexture->getBounds() ).getCenteredFit( getWindowBounds(), true ) );
	
	drawMirrors( &mTriPieces );
	mTextRibbon->draw();
}
Exemplo n.º 5
0
void Clone::maskedBlur(gl::TextureRef tex, gl::TextureRef mask, gl::FboRef result)
{
    gl::ScopedTextureBind t2(mask, 2);
    gl::ScopedGlslProg glsl(mMaskBlurShader);

    {
        gl::ScopedFramebuffer fbo(mBufferFbo);
        gl::clear(ColorA::black(), false);
        gl::ScopedTextureBind t1(tex, 1);
        mMaskBlurShader->uniform("direction", vec2(1, 0));
        gl::drawSolidRect(tex->getBounds());
    }

    {
        gl::ScopedFramebuffer fbo(result);
        gl::clear(ColorA::black(), false);
        gl::ScopedTextureBind t1(mBufferFbo->getColorTexture(), 1);
        mMaskBlurShader->uniform("direction", vec2(0, 1));
        gl::drawSolidRect(tex->getBounds());
    }
}
Exemplo n.º 6
0
void QuickTimeSampleApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) );
	gl::enableAlphaBlending();

	if( mFrameTexture ) {
		Rectf centeredRect = Rectf( mFrameTexture->getBounds() ).getCenteredFit( getWindowBounds(), true );
		gl::draw( mFrameTexture, centeredRect );
	}

	if( mInfoTexture ) {
		gl::draw( mInfoTexture, vec2( 20, getWindowHeight() - 20 - mInfoTexture->getHeight() ) );
	}
}
Exemplo n.º 7
0
void Clone::update(gl::TextureRef src, gl::TextureRef dst, gl::TextureRef mask)
{
    mMaskBlurShader->uniform("strength", mStrength);

    maskedBlur(src, mask, mSrcBlurFbo);
    maskedBlur(dst, mask, mDstBlurFbo);

    {
        gl::ScopedFramebuffer fbo(mBufferFbo);
        gl::ScopedBlendAlpha blend;
        gl::ScopedGlslProg glslTexOnly(gl::getStockShader(gl::ShaderDef().texture()));
        gl::draw(dst);

        gl::ScopedGlslProg glsl(mCloneShader);
        gl::ScopedTextureBind t1(src, 1);
        gl::ScopedTextureBind t2(mSrcBlurFbo->getColorTexture(), 2);
        gl::ScopedTextureBind t3(mDstBlurFbo->getColorTexture(), 3);
        gl::drawSolidRect(src->getBounds());
    }
}
void MotionTrackingTestApp::draw()
{
   // gl::setViewport( getWindowBounds() );
    // clear out the window with black
	gl::clear( Color( 1, 1, 1 ) );
    
//    if( mSurface ){
//        if( mTexture ){
//            mTexture->update( mSurface );
//        } else {
//            mTexture = gl::Texture::create( mSurface );
//        }
//        gl::draw( mTexture, mTexture->getBounds(), getWindowBounds() );
//    }
    
    if( mSurfaceDepth ){
        if( mTextureDepth ){
            mTextureDepth->update( Channel32f( mSurfaceDepth ) );
        } else {
            mTextureDepth = gl::Texture::create( Channel32f( mSurfaceDepth ) );
        }
        gl::color( Color::white() );
        gl::draw( mTextureDepth, mTextureDepth->getBounds() );
    }
    gl::pushMatrices();
    gl::translate( Vec2f( 320, 0 ) );
    if( mSurfaceBlur ){
        if( mTextureDepth ){
            mTextureDepth->update( Channel32f( mSurfaceBlur ) );
        } else {
            mTextureDepth = gl::Texture::create( Channel32f( mSurfaceBlur ) );
        }
        gl::draw( mTextureDepth, mTextureDepth->getBounds() );
    }
    gl::translate( Vec2f( 0, 240 ) );
    if( mSurfaceSubtract ){
        if( mTextureDepth ){
            mTextureDepth->update( Channel32f( mSurfaceSubtract ) );
        } else {
            mTextureDepth = gl::Texture::create( Channel32f( mSurfaceSubtract ) );
        }
        gl::draw( mTextureDepth, mTextureDepth->getBounds() );
    }
    gl::translate( Vec2f( -320, 0 ) );
    for( ContourVector::iterator iter = mContours.begin(); iter != mContours.end(); ++iter ){
        glBegin( GL_LINE_LOOP );
            for( vector< cv::Point >::iterator pt = iter->begin(); pt != iter->end(); ++pt ){
                gl::color( Color( 1.0f, 0.0f, 0.0f ) );
                gl::vertex( fromOcv( *pt ) );
            }
            glEnd();
    }
    gl::translate( Vec2f( 0, 240 ) );
    for( int i=0; i<mTrackedShapes.size(); i++){
        glBegin( GL_POINTS );
        for( int j=0; j<mTrackedShapes[i].hull.size(); j++ ){
           gl::color( Color( 1.0f, 0.0f, 0.0f ) );
           gl::vertex( fromOcv( mTrackedShapes[i].hull[j] ) );
        }
        glEnd();
    }
    gl::popMatrices();
    mParams->draw();
}