# The Industry's Foundation for High Performance Graphics

1. ## 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

2. ## Re: c++ terrain loops

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.

</a>

3. ## Re: c++ terrain loops

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.

4. ## Re: c++ terrain loops

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/...n-Introduction
but without success.
Thanks

5. ## Re: c++ terrain loops

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.

6. ## Re: c++ terrain loops

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?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•