O'Reilly logo

Cardboard VR Projects for Android by Matt Schoen, Jonathan Linowes

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

Random visualizations

We can switch between visualizations by adding and removing them over time. In the following example, we start with one active visualization and then every few seconds, toggle a random visualization on or off.

First, add an activate method to the abstract Visualization class, which takes a Boolean enabled parameter. The Boolean active variable is read-only:

    public boolean active = true;
    public abstract void activate(boolean enabled);

Its implementation will depend on the specific visualization. RenderBox library provides an enabled flag that's used when we render objects. The ones that instantiate a single Plane component are the easiest, such as WaveformVisualization and FFTVisualization. To each of these, add the following ...

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