We’ve covered a lot of the basics of live wallpapers in this chapter, but there’s still a lot of low-hanging fruit left for us to pick. Let’s start off with the following exercises:

  • To optimize performance, let’s change the way we initialize the particle system and reduce the total particle count from 10,000 to something a lot lower. Once that’s done, let’s optimize things further by removing particles that fall below the terrain. One way you can do this is by swapping each particle to be removed with the last good active particle in the array.

    When you make these changes, try updating the behavior so that the particle system doesn’t get reset if onSurfaceCreated is called a second time.

  • Android live wallpapers support an additional ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.