Building an OpenGL-friendly, GameObject super class
Let's dive straight into the code. As we will see, this
GameObject will have a lot in common with the
GameObject class from the previous project. The most significant difference will be that this latest
GameObject will of course draw itself using a handle to the GL program, primitive (vertex) data from a child class, and the viewport matrix contained in
Create a new class, call it
GameObject, and enter these import statements, noting again that that some of them are static:
import android.graphics.PointF; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import static android.opengl.GLES20.GL_FLOAT; import static android.opengl.GLES20.GL_LINES; ...