Drawing the Particle System

We just need to add some code to ParticlesRenderer and then we can finally see our particles in action. Let’s start out with the following definitions:

Particles/src/com/particles/android/ParticlesRenderer.java
 
private​ ​final​ ​Context​ context;
 
 
private​ ​final​ ​float​​[]​ projectionMatrix = ​new​ ​float​[16];
 
private​ ​final​ ​float​​[]​ viewMatrix = ​new​ ​float​[16];
 
private​ ​final​ ​float​​[]​ viewProjectionMatrix = ​new​ ​float​[16];
 
 
private​ ParticleShaderProgram particleProgram;
 
private​ ParticleSystem particleSystem;
 
private​ ParticleShooter redParticleShooter;
 
private​ ParticleShooter greenParticleShooter;
 
private​ ParticleShooter blueParticleShooter;
 
private​ ​long​ globalStartTime; ...

Get OpenGL ES 2 for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.