• Advertisement

Archived

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

Loding *.raw files

This topic is 5321 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

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
Advertisement
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
Sorry about the AP, I forgot to enter my password.

You only have enough size for 1 row, now 1 byte I mean.

Share this post


Link to post
Share on other sites

  • Advertisement