Hello, triangle!

Let's add a triangle to the scene. Yeah, I know that a triangle isn't even a box. However, we're going to start with super simple tips. Triangles are the building blocks of all 3D graphics and the simplest shapes that OpenGL can render (that is, in triangle mode).

Introducing geometry

Before moving on, let's talk a little about geometry.

Virtual reality is largely about creating 3D scenes. Complex models are organized as three-dimensional data with vertices, faces, and meshes, forming objects that can be hierarchically assembled into more complex models. For now, we're taking a really simple approach—a triangle with three vertices, stored as a simple Java array.

The triangle is composed of three vertices (that's why, it's called a ...

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.