Jump to content
  • Advertisement


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


Decoding a 24 bit pcx file

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

I am trying to load a 24 bit pcx as texture for use in an opengl project that I am working on. However I am haveing problems decoding the file. I am allocating mem like so: malloc(width*height*3); I don''t know if this is correct. How do I then decode the file. Oh I extract data like // extract from loader /* get dimensions */ x1 = fgetc(fp); x1 |= fgetc(fp)<<8; y1 = fgetc(fp); y1 |= fgetc(fp)<<8; x2 = fgetc(fp); x2 |= fgetc(fp)<<8; y2 = fgetc(fp); y2 |= fgetc(fp)<<8; pcx->pcxWidth= x2 - x1 +1; pcx->pcxHeight= y2 - y1 +1; printf("pcx width %d\n", pcx->pcxWidth); // fine up to printf("pcx height %d\n", pcx->pcxHeight);// here /* seek start of data */ fseek(fp, 128, SEEK_SET); decode??? any suggestions, pointer to examples etc. would be most helpful.

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!