O'Reilly logo

Mastering openFrameworks: Creative Coding Demystified by Denis Perevalov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

An emitter

In this section, we add to the project the emitter, which will create particles at a specified rate.

Note

An example of this is 03-Particles/02-ParticlesEmitter.

The example is based on the 03-Particles/01-SingleParticle project, implemented in the previous section. We implement the emitter right inside the testApp class. In the class declaration, replace the following line with declaration of a single particle Particle p; with an array of particles:

vector<Particle> p;    //Particles

Note

We will delete inactive particles from any parts of the p array. So for computational efficiency, it is preferable to use the deque class instead of vector. But for simplicity, in this example, we use vector. It works fast enough for our purposes in the example. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required