Defining shapes

In order to draw something on the screen, we first need to define its shape and then render it. So we won't define our shape in our render class. We will create a new class in order to define our shape. As discussed, we will first create a basic triangle.

In order to create our triangle, we need to first define its vertices. So, let's create a new class named and start writing our logic to define the shape of our 3D triangle. Before we start writing our code, let's try to understand what we are actually going to do.

We will take vertices and plot them on our screen. Also, as you saw previously how OpenGL coordinates work, we will plot our vertices in all three directions. For our triangle, we require three points ...

Get Learning Android Game Development now with the O’Reilly learning platform.

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