Making a Live Wallpaper in Native OpenGL

Faster and More Battery Efficient

Jacob’s Ladder is open-source on Github. The Github repo also contains a base library you can use to make your own native Live Wallpaper (see below for instructions).

Making your Live Wallpaper slick and battery-efficient takes a concerted effort. When I decided to put Jacob’s Ladder on the Play Store, I prioritized reducing power consumption and maintaining a high frame rate.

On my Nexus 5 the frame rate goes as high as 100 frames per second and despite the number of vertices, after running for 20 minutes the battery usage remained below 1%:

 Black_cubes.gif Purple_cubes.gif

screenshot_20170204-174800
After running for 20 mins, battery usage is less than 1%

screen-shot-2017-02-04-at-3-01-07-pm
Average frame renders in 8ms

Screenshots of Jacob’s Ladder running on a Nexus 5, Marshmallow. 

To efficiently render about 2000 vertices per frame requires a lean rendering pipeline. This pipeline starts at the Java Wallpaper class, runs through native (C++) code to the GPU, where it finally shows on screen. Any performance optimizations you make along this path will smooth out the rendering and ultimately improve the experience.

jni Continue reading “Making a Live Wallpaper in Native OpenGL”