Jump to content
  • Advertisement

Archived

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

the origin

read out in an array

This topic is 5996 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!