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

Trippy trails mode

If you are craving hallucinogenic simulations, we'll introduce a "trippy trails mode" to our visualizations! The implementation is added to the RenderBox library itself. If you're using the completed RenderBox library, then just toggle on the mode in your app. For example, in setup() of MainActivity, add the following line of code at the end:

        RenderBox.mainCamera.trailsMode = true;

To implement it in your copy of RenderBox library, open that project (in Android Studio). In the Camera class (the components/Camera.java file), add public boolean trailsMode:

    public boolean trailsMode;

Then, in onDrawEye, instead of erasing the screen for the new frame, we'll draw a full screen quad over the entire frame, with alpha transparency, thus ...

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