In this recipe we will render particles introduced in the previous chapter using texture loaded from the PNG file.
This recipe code base is an example of the recipe Simulating particles flying on the wind from Chapter 5, Building Particle Systems. We also need a texture for a single particle. You can prepare one easily with probably any graphical program. For this example, we are going to use a PNG file with transparency stored inside the assets
folder with a name, particle.png
. In this case it is just a radial gradient with transparency.
We will render particles using the previously created texture.
Include the necessary header files:
#include "cinder/gl/Texture.h" #include "cinder/ImageIo.h"
Add a member to the application main class:
gl::Texture particleTexture;
Inside the
setup
method loadparticleTexture
:particleTexture=gl::Texture(loadImage(loadAsset("particle.png")));
We also have to change the particle size for this example:
float radius = Rand...