Archived

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

Aram

Loding *.raw files

Recommended Posts

Is this the right way to load an 8-bit raw file? Cause when I use the file data in my heightmap it looks like as if all the data is randomized. Thanks Aram
BYTE	*pHeightMap;
int      Size = 64:

FILE *pfile = NULL;
pfile = fopen( dirpath, "rb" );

pHeightMap = new BYTE[Size];

fread( pHeightMap, sizeof(BYTE), Size, pfile );

fclose( pfile );

Share this post


Link to post
Share on other sites
Hello,

You do this:
fread( pHeightMap, sizeof(BYTE), Size, pfile );

When I do this:
fread( pHeightMap, 1, Size, pfile );

Not sure if it''s the problem, but you can always try =)

Regards,
Deficte

Share this post


Link to post
Share on other sites
Isn''t sizeof(BYTE) equal to one?.. Well I tried to change it to one but it still didn''t help. I hate to get stuck like this :/.

Thanks for the quick reply. =)

Aram

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Aram



BYTE *pHeightMap;








BYTE * Heightmap;

int size=64;

Heightmap=new BYTE[size*size];




Then read in your data. As it sits now, you can only read in 1 byte.

Share this post


Link to post
Share on other sites