Defining 3D Meshes

So far, you've only used a couple of triangles as placeholders for objects in your worlds. What about more complex objects?

We already talked about how the GPU is just a big, mean triangle-rendering machine. All the 3D objects, therefore, have to be composed of triangles as well. In the previous chapters, two triangles were used to represent a flat rectangle. The principles used there, like vertex positioning, colors, texturing, and vertex indexing, are exactly the same in 3D. The triangles are just not limited to lie in the x-y plane anymore; you can freely specify each vertex's position in 3D space.

How do you go about creating such soups of triangles that make up a 3D object? You can do that programmatically, as you've done ...

Get Beginning Android 4 Games Development 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.