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

Multiple simultaneous visualizations

Now that we have a collection of visualizations, we can enhance the app to run more than one at a time and switch between them.

To support multiple concurrent visualizations, replace the activeViz variable in VisualizerBox with a list of visualizations:

public List<Visualization> visualizations = new ArrayList<Visualization|();

Then, cycle through the list in each of the VisualizerBox method that use it. We always want to set up all of them, but then only draw (preDraw, postDraw) the active ones:

 public void setup() { audioTexture = genTexture(); fftTexture = genTexture(); for (Visualization viz : visualizations) { viz.setup(); } } public void preDraw() { for (Visualization viz : visualizations) { viz.preDraw(); ...

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