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

A simple box scene

Let's rock this riddim! Make a scene with just a cube and, of course, a camera (which has been set up automatically by RenderBox). Set up the MainActivity class using the IRenderBox interface's setup callback.

In setup of MainActivity, we create a Transform for the cube and position it so that it's set back and slightly offset in space:

    Transform cube;

        @Override
    public void setup() {
        cube = new Transform();
        cube.addComponent(new Cube());
        cube.setLocalPosition(2.0f, -2.f, -5.0f);
    }

In Android Studio, click on Run. The program should compile, build, and install onto your connected Android phone. If you receive any compile errors, fix them now! As mentioned earlier, with the Matrix class, make sure that you are importing the right ...

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