Archived

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

brush

Decoding a 24 bit pcx file

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