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

Creating a Set of Shaders for a Simple Particle System

Let’s start things off by adding a very simple particle system to represent a fountain. We can imagine this as a fountain of water lit up by a light underneath, or we can imagine it as a fireworks fountain, like we might see at a fireworks show. To get this fountain started, we’ll need to take care of a few technical details.

First, we need some way of representing all of the particles in memory. We could use an array of Java objects for this, but it can be expensive to create and delete a bunch of objects during runtime, and there’s no easy way to send the data over to OpenGL. We can store all of the particle data inline instead, inside a single array, such as seen in Figure 49, Layout ...

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