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

Method draw

samples/_opengl/ParticlesBasic/src/ParticlesBasicApp.cpp:94–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void BasicParticleApp::draw()
95{
96 // Clear the window.
97 gl::clear( Color::gray( 0.1f ) );
98
99 // Enable additive blending.
100 gl::ScopedBlendAdditive blend;
101
102 // Draw all the particles as lines from mPosition to mLastPosition.
103 // We use the convenience methods begin(), color(), vertex() and end() for simplicity,
104 // see the ParticleSphere* samples for a faster method.
105 gl::begin( GL_LINES );
106 for( auto &particle : mParticles ) {
107 // Color according to velocity.
108 gl::color( 0.5f + particle.mVelocity.x / ( mSpeed * 2 ), 0.5f + particle.mVelocity.y / ( mSpeed * 2 ), 0.5f + particle.mZ * 0.5f );
109 gl::vertex( particle.mLastPosition );
110 gl::vertex( particle.mPosition );
111 }
112 gl::end();
113}
114
115void BasicParticleApp::keyDown( KeyEvent event )
116{

Callers

nothing calls this directly

Calls 6

grayFunction · 0.85
clearFunction · 0.50
beginFunction · 0.50
colorFunction · 0.50
vertexFunction · 0.50
endFunction · 0.50

Tested by

no test coverage detected