Heightmap with array doesn't work

First of all. THX for the monkey. Love to work with it very much!

So here is my thing:

I’m creating graymaps (2D Heightmaps) with different algorithms like Diamond Square, Perlin Noise…
This looks like this

If I follow your Beginner Tutorial and replace the example heightmap *.png with my *.png it looks like this.

(it is not pretty but it works ;))

The way I see it, it is possible to work with an array. Unfortunately I have a 2D array which I convert in 1D like this:

Heightmap map = new DiamondSquare();

	float[] newMap = new float[map.length * map.length];
	int[][] grayMap = map.getMap();

	int y = 0;
	int x = 0;

	for (int i = 0; i < newMap.length; i++, x++)

		newMap[i] = grayMap[y][x];

		if (x % 512 == 0 && i != 0)
			x = 0;


	terrain = new TerrainQuad("my terrain", patchSize, 513, newMap);


After I start the monkey the same heightmap as seen above looks like this:

All maps have these waves and I don’t know what I’m doing wrong. Like I said. I used the same code in the tutorial. Only this piece of code is different.

What am I doing wrong?

Thx and Greetz


System.out.println() your values and I think you’ll find your issue probably. I don’t see it just in the code provided but it is kind of a strange way to go from 2D to 1D, though.