Advertisement

read out in an array

Started by February 20, 2002 02:12 PM
3 comments, last by the origin 23 years ago
    
 void LoadRawFile(LPSTR strName, int nSize, BYTE *pHeightMap)
{FILE *pFile = NULL;
pFile = fopen( strName, "rb" );
fread( pHeightMap, 1, nSize, pFile );
int result = ferror( pFile );
fclose(pFile);
}

int InitGL(GLvoid)
{
....	

...

LoadRawFile("Data/Terrain.raw", MAP_SIZE * MAP_SIZE,g_HeightMap);

....									}  
 
    
how can i read out these datas to the array WORLD[256][256]; ???? thanks Edited by - the origin on February 20, 2002 3:15:25 PM
Why do you need other WORLD variable?
just go
g_HeightMap[x][y] instead of WORLD[x][y] ...

" Do we need us? "


Ionware Productions - Games and Game Tools Development

Advertisement
but i doesnt work

i think because

g_HeightMap is an onedimesionlal array

but i need it in an twodimensional array

world [256][256];

or is it something else ....
but i doesnt work

i think because

g_HeightMap is an onedimesionlal array

but i need it in an twodimensional array

world [256][256];

or is it something else ....
Don''t know if this will help, but the normal way to find the data at (x,y) in a one-dimensional array is to do the following:

array[width*y + x]
-------------------------------------------------------BZZZZTT - CRASH - BANG"What was that?!""Captain, it appears that we have encountered a strange sub-space anomaly. I'm getting a high reading of tracheons beams. The anomaly seems to be some kind of rift in the space-time continuum. -- Never mind, Bones was just using the microwave again."

This topic is closed to new replies.

Advertisement