Creating a New Class Structure for Our Vertex Data

We’ll start off by separating our vertex data into separate classes, with one class to represent each type of physical object. We’ll create one class for our table and another for our mallet. We won’t need one for the line, since there’s already a line on our texture.

We’ll also create a separate class to encapsulate the actual vertex array and to reduce code duplication. Our class structure will look as follows:

images/Textures/ObjectHierarchy.png

We’ll create Mallet to manage the mallet data and Table to manage the table data; and each class will have an instance of VertexArray, which will encapsulate the FloatBuffer storing ...

Get OpenGL ES 2 for Android 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.