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