Creating a Sphere component

Our Solar System will be constructed from spheres, representing planets, moons, and the Sun. Let's first create a Sphere component. We are going to define a sphere as a triangle mesh of vertices that form the surface of the sphere (For more information on a triangle mesh, refer to

Right-click on the RenderBoxExt/components folder, select New | Java Class, and name it Sphere. Define it as public class Sphere extends RenderObject:

public class Sphere extends RenderObject{
    private static final String TAG = "RenderBox.Sphere";
    public Sphere() {

The constructor calls a helper method, allocateBuffers, which allocates buffers for vertices, normals, ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.