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

Viewing a regular photo

Now that we got that done, let's prepare our app to also be able to view regular flat photos. We'll do this by rendering them onto a plane. So first we need to define a Plane component.

Defining the Plane component and allocating buffers

The Plane component rightfully belongs to the RenderBox library, but for the time being, we'll add it directly to the app.

Create a new Java class file in the RenderBoxExt/components/ folder, and name it Plane. Define it as extends RenderObject, as follows:

public class Plane extends RenderObject {
}

As with other geometry in the RenderBox library, we'll define the plane with triangles. Simply two adjacent triangles are required, a total of six indices. The following data arrays define our ...

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