Work with 3D Primitives and Lights

For our first 3D app, let’s explore simple geometry and lights to get a feel for the 3D coordinate system and learn how to control the position and scale of 3D objects on the device’s display. We’ll get started with two 3D primitives, the sphere and the box, and also define the scene lights using an ambient and a directional light source, as illustrated in the figure.

To create the 3D scene, we use the size method, which we’ve used so far only for the desktop applications we’ve created. The method defines the window width and height, but it can also be used to replace the default Processing 2D (P2D) renderer. For the Android apps we’ve created so far, we haven’t used size, because if we don’t use it, Processing ...

Get Rapid Android 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.