c++ terrain loops

Hi
i get z values by feeding/incrementing x and y. So i have for ex. 1-1386 z values and the question how to output those to a field of 128x128? (x/y)
Many thanks

Hang on a mo.
You posted a cryptic message in the Maths & Alg section
3D Terrain

…and now you are doing the same thing again here.

Your posts are so cryptic no wonder nobody is replying.
Have you actually read the <a href=“Khronos Forums - Khronos Standards community discussions” rel=“nofollow” target=“_blank”>posting guidelines?
</a>

128x128 = 16384, so there is no way you’re gonna get thos 1386 values assigned with a one to one mapping. You could randomly select 1386 vertices out of the range of [0, 128] but I doubt that makes any sense.

And I have to agree with BionicBytes. I had to read the above linked post of yours about 4 times before I kind of got what you wanted.

for(loopz=0 ; loopz< MapReso; loopz++ ){
same for x…
function returning z WeltAlt
terrainMap[x][loopz][0] = x;
terrainMap[x][loopz][1] = dWeltAlt/100; //altitude
terrainMap[x][loopz][2] = -loopz;

I only need to get dWeltAlt into terrainMap[128][128][3] but
something is wrong…any ideas? Basically I’m following:
http://www.codeproject.com/Articles/14154/OpenGL-Terrain-Generation-An-Introduction
but without success.
Thanks

Well you could follow it more carefully …
Seriously. Just how are you suggesting we go about commenting on what’s wrong when we don’t know what specifically is not working. We are not telepaths you know. you actually need to describe the issue and post relevant code sections.

If I’d know I wouldn’t need to ask…
I guess, at least that’s what I don’t understand is the z returning function takes 2 x and y arguments for each loop x and loopz.
for x
posx++
posy++
for loopz
posx++
posy++
return z (a struct with x,y,z etc values)
now for 2D I only read out those results while x<16384 but how to do alike in 3D?