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

Method draw

samples/HighDensityDisplay/src/HighDensityDisplayApp.cpp:67–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void HighDensityDisplayApp::draw()
68{
69 gl::clear( Color( 0.1f, 0.1f, 0.15f ) );
70 gl::enableAlphaBlending();
71
72 gl::pushModelMatrix();
73 gl::color( 1.0f, 0.5f, 0.25f );
74 gl::lineWidth( toPixels( 1.0f ) );
75 gl::draw( mPoints );
76 gl::popModelMatrix();
77
78 // rotate a 200x200pt square at the center of the window
79 gl::pushModelMatrix();
80 gl::color( 1.0f, 0.2f, 0.15f );
81 gl::translate( getWindowCenter() );
82 gl::rotate( float(getElapsedSeconds() / 10) );
83 gl::drawSolidRect( Rectf( Area( -100, -100, 100, 100 ) ) );
84 gl::popModelMatrix();
85
86 // draw the logo in the lower-left corner at 64x64 points
87 gl::color( Color::white() );
88 gl::draw( mLogo, Rectf( 0, getWindowHeight() - 64, 64, getWindowHeight() ) );
89
90 // The font has been made double the size we need for non-Retina, so we always scale by 0.5f
91 // another strategy would be to use two different TextureFonts
92 std::string s = ( getWindowContentScale() > 1.0f ) ? "High Density" : "Non-High Density";
93 float stringWidth = mFont->measureString( s ).x * 0.5f;
94 mFont->drawString( s, vec2( getWindowWidth() - stringWidth - 12, getWindowHeight() - 12 ),
95 gl::TextureFont::DrawOptions().scale( 0.5f ).pixelSnap( false ) );
96}
97
98CINDER_APP( HighDensityDisplayApp, RendererGl, prepareSettings )

Callers

nothing calls this directly

Calls 15

enableAlphaBlendingFunction · 0.85
pushModelMatrixFunction · 0.85
popModelMatrixFunction · 0.85
getWindowCenterFunction · 0.85
drawSolidRectFunction · 0.85
whiteFunction · 0.85
getWindowHeightFunction · 0.85
getWindowContentScaleFunction · 0.85
getWindowWidthFunction · 0.85
DrawOptionsFunction · 0.85
measureStringMethod · 0.80
drawStringMethod · 0.80

Tested by

no test coverage detected