June 2013
Intermediate to advanced
346 pages
8h 42m
English
When we do different effects in OpenGL, we often have to think back to the effect that we’re trying to reproduce. If we imagine our three particle streams as a fireworks fountain, like the one we’d see at a fireworks show, then we’d expect the particles to give off light; and the more of them there are, the brighter things should be. One of the ways that we can reproduce this effect is by using additive blending.
Let’s enable blending by adding the following code to ParticlesRenderer in the onSurfaceCreated method:
| Particles/src/com/particles/android/ParticlesRenderer.java | |
| | glEnable(GL_BLEND); |
| | glBlendFunc(GL_ONE, GL_ONE); |
That’s it! First we enable blending, and then we set the blending mode to additive ...
Read now
Unlock full access