Archived

This topic is now archived and is closed to further replies.

the origin

read out in an array

Recommended Posts

    
 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

Share this post


Link to post
Share on other sites
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 ....

Share this post


Link to post
Share on other sites
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 ....

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites