Jump to content
  • Advertisement

Archived

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

Aram

Loding *.raw files

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

  • 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!