As we've learned from the previous part, we will first create a class of our pyramid in order to define our shape. So create a file Pyramid.java to define the shape of our pyramid object.
Our pyramid has five faces, so we will require five vertices to draw our pyramid. So after you create your Pyramid.java, we will define our vertices, as follows:
//Package name of our gamepublic class Pyramid { private float[] vp = { // 5 vertices of the pyramid in (x,y,z) -1.0f, -1.0f, -1.0f, //left-bottom-back 1.0f, -1.0f, -1.0f, //right-bottom-back 1.0f, -1.0f, 1.0f, //right-bottom-front -1.0f, -1.0f, 1.0f, //left-bottom-front 0.0f, 1.0f, 0.0f //top };}
Alright, now we have our vertices set, but just like our triangle, we still have ...