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 ...

Get Cardboard VR Projects for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.