View Full Version : c++ terrain loops

01-24-2012, 06:17 AM
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

01-24-2012, 09:46 AM
Hang on a mo.
You posted a cryptic message in the Maths & Alg section
3D Terrain (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=309191#Post3091 91)

...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="http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&amp;Number=305969&amp;an=2#Pos t305969" rel="nofollow" target="_blank">posting guidelines?

01-24-2012, 11:14 AM
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.

01-27-2012, 07:35 AM
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:
but without success.

01-27-2012, 12:42 PM
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.

01-27-2012, 11:12 PM
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
for loopz
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?