예제 #1
0
void BasicApp::draw()
{
	gl::viewport( getWindowSize() );
	gl::clear();
	gl::setMatricesWindow( getWindowSize() );
	gl::enableAlphaBlending();
	
	if ( mSurfaceColor ) {
		gl::TextureRef tex = gl::Texture::create( *mSurfaceColor );
		gl::draw( tex, tex->getBounds(), Rectf( vec2( 0.0f ), getWindowCenter() ) );
	}
	if ( mChannelDepth ) {
		gl::TextureRef tex = gl::Texture::create( *Kinect2::channel16To8( mChannelDepth ) );
		gl::draw( tex, tex->getBounds(), Rectf( getWindowCenter().x, 0.0f, (float)getWindowWidth(), getWindowCenter().y ) );
	}
	if ( mChannelInfrared ) {
		gl::TextureRef tex = gl::Texture::create( *mChannelInfrared );
		gl::draw( tex, tex->getBounds(), Rectf( 0.0f, getWindowCenter().y, getWindowCenter().x, (float)getWindowHeight() ) );
	}
	if ( mChannelBodyIndex ) {
		gl::TextureRef tex = gl::Texture::create( *Kinect2::colorizeBodyIndex( mChannelBodyIndex ) );
		gl::draw( tex, tex->getBounds(), Rectf( getWindowCenter(), vec2( getWindowSize() ) ) );
	}

	mParams->draw();
}
예제 #2
0
void WebClientApp::draw()
{
	gl::clear( Colorf::black() );
	gl::setMatricesWindow( getWindowSize() );
	
	if ( mTexture ) {
		gl::draw( mTexture, ivec2( 250, 20 ) );
	}
	
	mParams->draw();
}
예제 #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();
}
예제 #4
0
void TcpClientApp::draw()
{
	gl::setViewport( getWindowBounds() );
	gl::clear( Colorf::black() );
	gl::setMatricesWindow( getWindowSize() );
	
	if ( mTexture ) {
		gl::draw( mTexture, Vec2i( 250, 20 ) );
	}

	mParams->draw();
}
예제 #5
0
void FaceApp::draw()
{
	gl::setViewport( getWindowBounds() );
	gl::clear();
	gl::setMatricesWindow( getWindowSize() );

	if ( mSurface ) {	
		gl::color( Colorf::white() );
		gl::enable( GL_TEXTURE_2D );
		gl::TextureRef tex = gl::Texture::create( mSurface );
		gl::draw( tex, tex->getBounds(), Rectf( getWindowBounds() ) );
	
		gl::disable( GL_TEXTURE_2D );
		gl::pushMatrices();
		gl::scale( Vec2f( getWindowSize() ) / Vec2f( mSurface.getSize() ) );
		
		for ( const Kinect2::Face3d& face : mFaces3d ) {
			const TriMesh& mesh = face.getMesh();
			if ( mesh.getNumIndices() > 0 ) {
				vector<Vec2f> verts;
				for ( const Vec3f& i : mesh.getVertices() ) {
					Vec2f v = mDevice->mapCameraToColor( i );
					verts.push_back( v );
				}

				gl::lineWidth( 0.5f );
				gl::enableWireframe();
				TriMesh2d mesh2d;
				mesh2d.appendIndices( &mesh.getIndices()[ 0 ], mesh.getNumIndices() );
				mesh2d.appendVertices( &verts[ 0 ], mesh.getNumVertices() );
				gl::draw( mesh2d );
				gl::disableWireframe();
			}
		}
		
		if ( mEnabledFace3d ) {
			gl::color( Colorf( 1.0f, 0.0f, 0.0f ) );
		} else {
			gl::lineWidth( 2.0f );
		}
		for ( const Kinect2::Face2d& face : mFaces2d ) {
			if ( face.isTracked() ) {
				gl::drawStrokedRect( face.getBoundsColor() );
				for ( const Vec2f& i : face.getPointsColor() ) {
					gl::drawSolidCircle( i, 3.0f, 16 );
				}
			}
		}
		gl::popMatrices();
	}

	mParams->draw();
}
예제 #6
0
void ClientApp::draw()
{
	gl::setViewport( getWindowBounds() );
	gl::clear();
	gl::setMatricesWindow( getWindowSize() );

	if ( mTexture ) {
		gl::enableAlphaBlending();
		gl::draw( mTexture, getWindowCenter() - mSize * 0.5f );
	}

	mParams->draw();
}
예제 #7
0
void ImageApp::draw()
{
	gl::setViewport( getWindowBounds() );
	gl::clear( Colorf::white() );
	gl::setMatricesWindow( getWindowSize() );
	gl::color( ColorAf::white() );

	size_t i = 0;
	const Leap::ImageList& images = mFrame.images();
	for ( Leap::ImageList::const_iterator iter = images.begin(); iter != images.end(); ++iter, ++i ) {
		const Leap::Image& img = *iter;

		Channel8u channel = LeapMotion::toChannel8u( img );
		gl::draw( gl::Texture::create( channel ), channel.getBounds(), getWindowBounds() );
	}
	
	mParams->draw();
}
예제 #8
0
void GestureApp::draw()
{
	gl::viewport( getWindowSize() );
	gl::clear( mBackgroundColor + Colorf::gray( mBackgroundBrightness ) );
	gl::setMatricesWindow( getWindowSize() );
	gl::enableAlphaBlending();
	gl::color( Colorf::white() );
	
	{
		const gl::ScopedMatrices scopedMatrices;
		gl::translate( mOffset );
		
		drawUi();
		drawGestures();
		drawPointables();
	}

	mParams->draw();
}
예제 #9
0
void SegmentationApp::draw()
{
	// clear out the window with black
	gl::clear( Color( 0, 0, 0 ) );
    gl::color(1, 1, 1);
    gl::drawStrokedRoundedRect(firstImageRect, 10);
    gl::drawStrokedRoundedRect(secondImageRect, 10);
    if(drawMode == DRAW_MODE::INPUT) {
        gl::Texture& inputTexture = inputImage.second;
        if(inputTexture) {
            gl::pushMatrices();
            gl::translate(firstImageRect.getCenter());
            gl::scale(glScale,glScale);
            gl::translate(-inputTexture.getWidth()/2.f,-inputTexture.getHeight()/2.f);
            gl::draw(inputTexture);
            gl::popMatrices();
        }
    }
    else if(drawMode == DRAW_MODE::INPUT_GROUNDTRUTH) {
        gl::Texture& inputTexture = inputImage.second;
        if(inputTexture) {
            gl::pushMatrices();
            gl::translate(firstImageRect.getCenter());
            gl::scale(glScale,glScale);
            gl::translate(-inputTexture.getWidth()/2.f,-inputTexture.getHeight()/2.f);
            gl::draw(inputTexture);
            gl::popMatrices();
        }
        gl::Texture& groundTruthTexture = groundTruthImage.second;
        if(groundTruthTexture) {
            gl::pushMatrices();
            gl::translate(secondImageRect.getCenter());
            gl::scale(glScale,glScale);
            gl::translate(-groundTruthTexture.getWidth()/2.f,-groundTruthTexture.getHeight()/2.f);
            gl::draw(groundTruthTexture);
            gl::popMatrices();
        }
    }
    
    else if (drawMode == DRAW_MODE::THRESHOLD_GROUNDTRUTH) {
        gl::Texture& segmentationTexture = segmentedImage.second;
        if(segmentationTexture) {
            gl::pushMatrices();
            gl::translate(firstImageRect.getCenter());
            gl::scale(glScale,glScale);
            gl::translate(-segmentationTexture.getWidth()/2.f,-segmentationTexture.getHeight()/2.f);
            gl::draw(segmentationTexture);
            gl::popMatrices();
        }
        gl::Texture& groundTruthTexture = groundTruthImage.second;
        if(groundTruthTexture) {
            gl::pushMatrices();
            gl::translate(secondImageRect.getCenter());
            gl::scale(glScale,glScale);
            gl::translate(-groundTruthTexture.getWidth()/2.f,-groundTruthTexture.getHeight()/2.f);
            gl::draw(groundTruthTexture);
            gl::popMatrices();
        }
    }
    
    else if (drawMode == DRAW_MODE::INPUT_THRESHOLD) {
        gl::Texture& inputTexture = inputImage.second;
        if(inputTexture) {
            gl::pushMatrices();
            gl::translate(firstImageRect.getCenter());
            gl::scale(glScale,glScale);
            gl::translate(-inputTexture.getWidth()/2.f,-inputTexture.getHeight()/2.f);
            gl::draw(inputTexture);
            gl::popMatrices();
        }
        gl::Texture& thresholdTexture = segmentedImage.second;
        if(thresholdTexture) {
            gl::pushMatrices();
            gl::translate(secondImageRect.getCenter());
            gl::scale(glScale,glScale);
            gl::translate(-thresholdTexture.getWidth()/2.f,-thresholdTexture.getHeight()/2.f);
            gl::draw(thresholdTexture);
            gl::popMatrices();
        }
    }
    else if (drawMode == DRAW_MODE::INPUT_RESULT) {
        gl::Texture& inputTexture = inputImage.second;
        if(inputTexture) {
            gl::pushMatrices();
            gl::translate(firstImageRect.getCenter());
            gl::scale(glScale,glScale);
            gl::translate(-inputTexture.getWidth()/2.f,-inputTexture.getHeight()/2.f);
            gl::draw(inputTexture);
            gl::popMatrices();
        }
        gl::Texture& resultTexture = resultImage.second;
        if(resultTexture) {
            gl::pushMatrices();
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
            float glScale = (float)mouse->getGLScale();
            gl::scale(glScale,glScale);
            gl::translate(ci::Vec2d(mouse->getGLTx(), mouse->getGLTy()));
            gl::draw(resultTexture);
            gl::popMatrices();
        }
    }
    interface->draw();
}
예제 #10
0
void GpGpuApp::draw()
{
	// We're going to draw new data onto the "ping" FBO,
	// using the "pong" FBO's textures as input
	size_t pong = ( mFboIndex + 1 ) % 2;
	
	// Set up OpenGL for data
	gl::disableDepthRead();
	gl::disableDepthWrite();
	gl::setViewport( mFbo[ mFboIndex ].getBounds() );
	gl::color( ColorAf::white() );
	
	// Draw any new input onto the acceleration texture
	mFbo[ pong ].bindFramebuffer();
	glDrawBuffer( GL_COLOR_ATTACHMENT2 );
	if ( mMouseDown ) {
		Vec2f fboSize	= Vec2f( mFbo[ mFboIndex ].getSize() );
		Vec2f winSize	= Vec2f( app::getWindowSize() );
		
		gl::setMatricesWindow( fboSize, true );
		
		Vec2f brushSize	= Vec2f::one() * mBrushSize * fboSize;
		Vec2f pos		= ( mMouse / winSize );
		pos.y			= 1.0f - pos.y;
		pos				*= fboSize;
		
		mGlslProgGpGpu0->bind();
		mGlslProgGpGpu0->uniform( "color", ColorAf( mMouseVelocity.x, 0.0f, 1.0f - mMouseVelocity.y, 1.0f ) );
		mGlslProgGpGpu0->uniform( "tex", 0 );
		
		gl::enable( GL_TEXTURE_2D );
		mTextureBrush->bind();
		gl::drawSolidRect( Rectf( pos - brushSize, pos + brushSize ) );
		mTextureBrush->unbind();
		gl::disable( GL_TEXTURE_2D );
		
		mGlslProgGpGpu0->unbind();
	}
	mFbo[ pong ].unbindFramebuffer();
	
	// Now let's do an update pass in GLSL
	mFbo[ mFboIndex ].bindFramebuffer();
	gl::setMatricesWindow( mFbo[ mFboIndex ].getSize(), false );
	
	// Bind the "pong" textures to use as input data
	for ( int32_t i = 0; i < 3; ++i ) {
		mFbo[ pong ].bindTexture( i, i );
	}
	
	// Set up shader to read data textures
	mGlslProgGpGpu1->bind();
	mGlslProgGpGpu1->uniform( "offsets",		0 );
	mGlslProgGpGpu1->uniform( "velocities",		1 );
	mGlslProgGpGpu1->uniform( "acceleration",	2 );
	
	// Draw a rect to process data
	glDrawBuffers( 3, kColorAttachments );
	gl::drawSolidRect( mFbo[ pong ].getBounds() );
	
	// Unbind everything
	mFbo[ pong ].unbindTexture();
	mGlslProgGpGpu1->unbind();
	mFbo[ mFboIndex ].unbindFramebuffer();
	
	// Swap FBOs
	mFboIndex = pong;
	
	/////////////////////////////////
	
	// Make sure we have data to work with before we draw geometry
	if ( mFbo[ mFboIndex ] &&
		mFbo[ mFboIndex ].getTexture( 0 ) &&
		mFbo[ mFboIndex ].getTexture( 1 ) ) {
		
		// Set up window for 3D drawing
		gl::clear( Colorf( 0.5f, 0.45f, 0.4f ) );
		gl::setViewport( getWindowBounds() );
		gl::setMatrices( mCamera );
		gl::enableDepthRead();
		gl::enableDepthWrite();
		gl::multModelView( mArcball.getQuat() );
		gl::color( ColorAf::black() );
		
		// Set up shader to render scene
		mGlslProgDraw->bind();
		mGlslProgDraw->uniform( "Ax",			mLightAmbient );
		mGlslProgDraw->uniform( "Ac",			mLightAttenuationConstant );
		mGlslProgDraw->uniform( "Al",			mLightAttenuationLinear );
		mGlslProgDraw->uniform( "Aq",			mLightAttenuationQuadratic );
		mGlslProgDraw->uniform( "Dx",			mLightDiffuse );
		mGlslProgDraw->uniform( "eyePoint",		mEyePoint );
		mGlslProgDraw->uniform( "Ka",			mMaterialAmbient );
		mGlslProgDraw->uniform( "Kd",			mMaterialDiffuse );
		mGlslProgDraw->uniform( "Ke",			mMaterialEmissive );
		mGlslProgDraw->uniform( "Ks",			mMaterialSpecular );
		mGlslProgDraw->uniform( "lightPos",		mLightPosition );
		mGlslProgDraw->uniform( "n",			mLightShine );
		mGlslProgDraw->uniform( "offsets",		0 );
		mGlslProgDraw->uniform( "projection",	mCamera.getProjectionMatrix() );
		mGlslProgDraw->uniform( "size",			Vec2f( mSize ) );
		mGlslProgDraw->uniform( "Sx",			mLightSpecular );
		mGlslProgDraw->uniform( "t",			(float)getElapsedSeconds() );
		
		// Bind textures to use as input data
		for ( int32_t i = 0; i <= 2; ++i ) {
			mFbo[ mFboIndex ].bindTexture( i, i );
		}
		
		// Draw instanced
		drawInstanced( mMesh, mSize.x * mSize.y );
		
		// Finished drawing
		mFbo[ mFboIndex ].unbindTexture();
		mGlslProgDraw->unbind();
		
		// Draw textures so we can see what's going on under the hood
		gl::setMatricesWindow( getWindowSize() );
		gl::disableDepthRead();
		gl::disableDepthWrite();
		gl::color( ColorAf::white() );
		gl::pushMatrices();
		
		float x = 20.0f;
		float y = 440.0f;
		
		float width = 64.0f;
		Area srcArea( Vec2i::zero(), mSize );
		Rectf destRect( x, y, x + width, y + width );
		
		gl::draw( mFbo[ 0 ].getTexture( 0 ), srcArea, destRect );
		destRect.x1 += width;
		destRect.x2 += width;
		gl::draw( mFbo[ 1 ].getTexture( 0 ), srcArea, destRect );
		
		destRect.y1 += width;
		destRect.y2 += width;
		destRect.x1 = x;
		destRect.x2 = x + width;
		gl::draw( mFbo[ 0 ].getTexture( 1 ), srcArea, destRect );
		destRect.x1 += width;
		destRect.x2 += width;
		gl::draw( mFbo[ 1 ].getTexture( 1 ), srcArea, destRect );
		
		destRect.y1 += width;
		destRect.y2 += width;
		destRect.x1 = x;
		destRect.x2 = x + width;
		gl::draw( mFbo[ 0 ].getTexture( 2 ), srcArea, destRect );
		destRect.x1 += width;
		destRect.x2 += width;
		gl::draw( mFbo[ 1 ].getTexture( 2 ), srcArea, destRect );
		gl::popMatrices();
	}
	
	// Draw parameters
	if ( getElapsedFrames() > 1 ) { // This condition prevents a memory leak
		mParams->draw();
	}
}
예제 #11
0
void LeapApp::draw()
{
	const gl::ScopedViewport scopedViewport( ivec2( 0 ), getWindowSize() );
	const gl::ScopedMatrices scopedMatrices;
	const gl::ScopedBlendAlpha scopedBlendAlpha;
	gl::clear( Colorf::white() );
	gl::setMatrices( mCamera );

	gl::enableDepthRead();
	gl::enableDepthWrite();
	
	float headLength = 6.0f;
	float headRadius = 3.0f;
	const Leap::HandList& hands = mFrame.hands();
	for ( Leap::HandList::const_iterator handIter = hands.begin(); handIter != hands.end(); ++handIter ) {
		const Leap::Hand& hand = *handIter;

		// Get hand data
		const vec3 handDir			= LeapMotion::toVec3( hand.direction() );
		const vec3 palmNorm			= LeapMotion::toVec3( hand.palmNormal() );
		const vec3 palmPos			= LeapMotion::toVec3( hand.palmPosition() );
		const vec3 palmVel			= LeapMotion::toVec3( hand.palmVelocity() );
		const vec3 sphereCenter		= LeapMotion::toVec3( hand.sphereCenter() );
		const float sphereRadius	= hand.sphereRadius();

		// Hand sphere
		{
			const gl::ScopedColor scopedColor( ColorAf( Colorf::gray( 0.9f ), 0.5f ) );
			gl::enableWireframe();
			gl::drawSphere( sphereCenter, sphereRadius, 16 );
			gl::disableWireframe();
		}

		// Hand plane
		{
			const gl::ScopedColor scopedColor( ColorAf( 0.75f, 0.0f, 0.75f, 0.25f ) );
			const gl::ScopedModelMatrix scopedModelMatrix;
			gl::translate( palmPos );
			gl::rotate( quat( palmPos, handDir ) );
			for ( float i = 0.25f; i <= 1.0f; i += 0.25f ) {
				gl::drawStrokedCircle( vec2( 0.0f ), sphereRadius * i, 16 );
			}
		}

		// Hand direction
		{
			const gl::ScopedColor scopedColor( ColorAf( 1.0f, 0.0f, 1.0f, 0.5f ) );
			gl::drawVector( palmPos, palmPos + handDir * 30.0f, headLength, headRadius );
		}

		// Hand normal
		{
			const gl::ScopedColor scopedColor( ColorAf( 0.0f, 0.0f, 1.0f, 0.5f ) );
			gl::drawVector( palmPos, palmPos + palmNorm * 30.0f, headLength, headRadius );
		}

		// Hand velocity
		{
			const gl::ScopedColor scopedColor( ColorAf( 0.0f, 1.0f, 0.0f, 0.5f ) );
			gl::drawVector( palmPos, palmPos + palmVel * 0.05f, headLength, headRadius );
		}

		// Fingers
		const Leap::PointableList& pointables = hand.pointables();
		for ( Leap::PointableList::const_iterator pointIter = pointables.begin(); pointIter != pointables.end(); ++pointIter ) {
			const Leap::Pointable& pointable = *pointIter;

			// Get pointable data
			const vec3 dir		= LeapMotion::toVec3( pointable.direction() );
			const bool isTool	= pointable.isTool();
			const float length	= pointable.length();
			const vec3 tipPos	= LeapMotion::toVec3( pointable.tipPosition() );
			const vec3 tipVel	= LeapMotion::toVec3( pointable.tipVelocity() );
			const float width	= pointable.width();
			const vec3 basePos	= tipPos + dir * -length;
			
			// Draw line representing pointable's length
			{
				const gl::ScopedColor scopedColor( ColorAf::gray( 0.3f ) );
				gl::drawLine( basePos, tipPos );
			}

			// Tip position
			{
				const gl::ScopedColor scopedColor( isTool ? Colorf( 1.0f, 0.0f, 0.0f ) : Colorf::black() );
				const gl::ScopedModelMatrix scopedModelMatrix;
				gl::translate( tipPos );
				gl::drawStrokedCircle( vec2( 0.0f ), width, 16 );
			}

			// Finger velocity
			{
				const gl::ScopedColor scopedColor( ColorAf( 0.0f, 1.0f, 0.0f, 0.5f ) );
				gl::drawVector( tipPos, tipPos + tipVel * 0.05f, headLength, headRadius );
			}
		}
	}
	
	mParams->draw();
}
예제 #12
0
void LeapApp::draw()
{
    gl::setViewport( getWindowBounds() );
    gl::clear( Colorf::white() );
    gl::setMatrices( mCamera );

    gl::enableAlphaBlending();
    gl::enableDepthRead();
    gl::enableDepthWrite();

    float headLength = 6.0f;
    float headRadius = 3.0f;
    const Leap::HandList& hands = mFrame.hands();
    for ( Leap::HandList::const_iterator handIter = hands.begin(); handIter != hands.end(); ++handIter ) {
        const Leap::Hand& hand = *handIter;

        // Get hand data
        Vec3f handDir		= LeapMotion::toVec3f( hand.direction() );
        Vec3f palmNorm		= LeapMotion::toVec3f( hand.palmNormal() );
        Vec3f palmPos		= LeapMotion::toVec3f( hand.palmPosition() );
        Vec3f palmVel		= LeapMotion::toVec3f( hand.palmVelocity() );
        Vec3f sphereCenter	= LeapMotion::toVec3f( hand.sphereCenter() );
        float sphereRadius	= hand.sphereRadius();

        // Hand sphere
        gl::enableWireframe();
        gl::color( ColorAf( Colorf::gray( 0.9f ), 0.5f ) );
        gl::drawSphere( sphereCenter, sphereRadius, 16 );
        gl::disableWireframe();

        // Hand plane
        gl::color( ColorAf( 0.75f, 0.0f, 0.75f, 0.25f ) );
        gl::pushMatrices();
        gl::translate( palmPos );
        gl::rotate( Quatf( palmPos, handDir ) );
        for ( float i = 0.25f; i <= 1.0f; i += 0.25f ) {
            gl::drawStrokedCircle( Vec2f::zero(), sphereRadius * i, 16 );
        }
        gl::popMatrices();

        // Hand direction
        gl::color( 1.0f, 0.0f, 1.0f, 0.5f );
        gl::drawVector( palmPos, palmPos + handDir * 30.0f, headLength, headRadius );

        // Hand normal
        gl::color( 0.0f, 0.0f, 1.0f, 0.5f );
        gl::drawVector( palmPos, palmPos + palmNorm * 30.0f, headLength, headRadius );

        // Hand velocity
        gl::color( 0.0f, 1.0f, 0.0f, 0.5f );
        gl::drawVector( palmPos, palmPos + palmVel * 0.05f, headLength, headRadius );

        // Fingers
        const Leap::PointableList& pointables = hand.pointables();
        for ( Leap::PointableList::const_iterator pointIter = pointables.begin(); pointIter != pointables.end(); ++pointIter ) {
            const Leap::Pointable& pointable = *pointIter;

            // Get pointable data
            Vec3f dir		= LeapMotion::toVec3f( pointable.direction() );
            bool isTool		= pointable.isTool();
            float length	= pointable.length();
            Vec3f tipPos	= LeapMotion::toVec3f( pointable.tipPosition() );
            Vec3f tipVel	= LeapMotion::toVec3f( pointable.tipVelocity() );
            float width		= pointable.width();
            Vec3f basePos	= tipPos + dir * -length;

            // Draw line representing pointable's length
            gl::color( ColorAf::gray( 0.3f ) );
            gl::drawLine( basePos, tipPos );

            // Tip position
            Colorf color = isTool ? Colorf( 1.0f, 0.0f, 0.0f ) : Colorf::black();
            gl::color( color );
            gl::pushMatrices();
            gl::translate( tipPos );
            gl::drawStrokedCircle( Vec2f::zero(), width, 16 );
            gl::popMatrices();

            // Finger velocity
            gl::color( 0.0f, 1.0f, 0.0f, 0.5f );
            gl::drawVector( tipPos, tipPos + tipVel * 0.05f, headLength, headRadius );
        }
    }

    mParams->draw();
}