# Heightmap vertex list to vertex + index list

Right now I'm trying to load a heightmap into my LWJGL application. I load it like that into a float[][] array and I can read the height value at a given x and z position in the map:

public class HeightMap
{

float[][] heightMap;

public HeightMap (String fileName)
{
int height, width;
try
{
heightMap = new float[image.getWidth()][image.getHeight()];
for (int x = 0; x < image.getHeight(); ++x)
{
for (int z = 0; z < image.getWidth(); ++z)
{
heightMap[x][z] = new Color(image.getRGB(x, z)).getRed() / 255f;
}
}
}
catch (IOException e)
{
e.printStackTrace();
}
}


My problem is that I don't understand how to create the float[] vertices and byte[] indices arrays that I can pass to the vao and iao(and also texture coords (tco)).

Hope you can help me,

bebe