MCPcopy Create free account
hub / github.com/cinder/Cinder / draw

Method draw

samples/BezierPath/src/BezierPathApp.cpp:95–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void Path2dApp::draw()
96{
97 gl::clear( Color( 0.0f, 0.1f, 0.2f ) );
98
99 // draw the control points
100 gl::color( Color( 1, 1, 0 ) );
101 for( size_t p = 0; p < mPath.getNumPoints(); ++p )
102 gl::drawSolidCircle( mPath.getPoint( p ), 2.5f );
103
104 // draw the precise bounding box
105 if( mPath.getNumSegments() > 1 ) {
106 gl::color( ColorA( 0, 1, 1, 0.2f ) );
107 gl::drawSolidRect( mPath.calcPreciseBoundingBox() );
108 }
109
110 // draw the curve itself
111 gl::color( Color( 1.0f, 0.5f, 0.25f ) );
112 gl::draw( mPath );
113
114 if( mPath.getNumSegments() > 1 ) {
115 // draw some tangents
116 gl::color( Color( 0.2f, 0.9f, 0.2f ) );
117 for( float t = 0; t < 1; t += 0.2f )
118 gl::drawLine( mPath.getPosition( t ), mPath.getPosition( t ) + normalize( mPath.getTangent( t ) ) * 80.0f );
119
120 // draw circles at 1/4, 2/4 and 3/4 the length
121 gl::color( ColorA( 0.2f, 0.9f, 0.9f, 0.5f ) );
122 for( float t = 0.25f; t < 1.0f; t += 0.25f )
123 gl::drawSolidCircle( mPath.getPosition( mPath.calcNormalizedTime( t ) ), 5.0f );
124 }
125}
126
127
128CINDER_APP( Path2dApp, RendererGl )

Callers

nothing calls this directly

Calls 12

drawSolidCircleFunction · 0.85
drawSolidRectFunction · 0.85
getTangentMethod · 0.80
calcNormalizedTimeMethod · 0.80
clearFunction · 0.50
ColorFunction · 0.50
colorFunction · 0.50
drawFunction · 0.50
drawLineFunction · 0.50
normalizeFunction · 0.50
getPositionMethod · 0.45

Tested by

no test coverage detected