To load the height map into OpenGL, we need to load in the image data and convert it into a set of vertices, one for each pixel. Each vertex will have a position based on its position in the image and a height based on the brightness of the pixel. Once we have all of the vertices loaded in, we’ll use the index buffer to group them into triangles that we can draw with OpenGL.
Let’s create a new class called Heightmap in the com.particles.android.objects package, adding the following code inside the class to start out:
private static final int POSITION_COMPONENT_COUNT = 3;
private final int width;
private final ...