"ahso" wrote in message
Hmm I'm trying as below without success. I need to move/copy the
struct values into terrainMap arrays to draw later in OpenGL.
Many thanks indeed
Michael
for( int xx=0; xx < 16384; xx++ ){
Buffr[xx]->dLaenge = dWeltLat;
Buffr[xx]->dBreite = dWeltLon;
Buffr[xx]->dHoehe = dWeltAlt;
Are dWeltLat, dWeltLon, dWeltAlt constant for the loop, or are they
calculated from xx?
px = ((int(dWeltLat)-1) % 128) + 1;
pz = ((int(dWeltAlt-1)) / 128) + 1;
I don't understand this calculation.
If dWeltLat and dWeltAlt are constant for the loop, then px and pz are
constant too.
Why don't you calculate py from dWeltLon?
What is the value of py for the first iteration?
terrainMap[xx][py][0] = px;//dWeltLat; //float(x)*MAP_SCALE/1000-0.2;
terrainMap[xx][py][1] = dWeltAlt/10; //(float)dWeltAlt/1000;
//altitude
terrainMap[xx][py][2] = pz;//dWeltAlt; //-float(z)*MAP_SCALE/1000-2;
//backwards
Has the comment any relation with the code?
if py starts at 0, then py equals xx, right?
So, why don't you write terrainMap[xx][xx] instead of terainMap[xx][py]
(or terrainMap[xx][xx%256] if py is an unsigned byte?)
this would make the code more clear.