O'Reilly logo

OpenGL ES 2 for Android by Kevin Brothaler

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

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; ...

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