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

Creating the ModelObject class

To begin with, we will define a ModelObject class that extends RenderObject. It will load model data from OBJ files and set up buffers needed by its material (and OpenGL ES shaders to be rendered in the VR scene).

Right-click on the app/java/com.cardboardvr.modelviewer/ folder, go to New | Java Class, and name it ModelObject. Define it so that it extends RenderObject, as follows:

public class ModelObject extends RenderObject {
}

Just like we've done in the previous chapters, when introducing new kinds of RenderObjects, we'll have one or more constructors that can instantiate a Material and set up buffers. For ModelObject, we'll pass in a file resource handle, parse the file (refer to the next topic), and create a solid ...

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