Rendering our 3D object

Based on our understanding of our previous example working with the triangle, we are pretty clear that in order to render our objects, we have to use our MyGLRenderer.java class. Since we are pretty clear on how our 3D rendering works, we will also add in our rotation code in the same code.

Here's one crucial thing to take into account though, we will be drawing our pyramid beside our triangle, so we have to make sure that we don't overlap our pyramid over our triangle. To do so, we will use the code gl.Translate() that we will observe as a follow up inside our onDrawFrame() code block after we draw our triangle.

We will work on our MyGLRenderer.java file, so open that file and write in the code marked in bold; the ...

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.