AUX_RGBImageRec to file

Started by
4 comments, last by TheMatrixXXX 22 years, 4 months ago
Hi all can someone tell me how to write a bmp which is loaded into an AUX_RGBImageRec in a file? my program only write 4 byte to file where are the pixel information in memory? thx for help --=[[TheMatrixXXX]]=--
--=[[TheMatrixXXX]]=--
Advertisement
first idea: a pointer?
"be fair! ... always"Zeusel
thats clear
but how can i write the data to a file?
i want to create texture archive like the wad files in hl
--=[[TheMatrixXXX]]=--
the aux... could be a buffer(?), im just newbish so i dont know it exactly!
"be fair! ... always"Zeusel
the struct for the aux_rgbimagerec is in glaux.h

basically it is
sizex
sizey
unsigned char *data

so all you have to do is save *data to a file. It makes it easier if you also save sizex and sizey so you know how big the image is.

the default size of the actual structure is sizex*sizey*3 as it is a 3 element array, red green blue.

fwrite(out,sizex*sizey*3,1,data) or something like that (forgot the order of fwrite) will do it for you, then jsut use malloc and fread to get them back in again.


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage
ps - when you said it only saves four bytes, that is because you are saving the pointer, ie a long, not the data it self.


Beer - the love catalyst
good ol'' homepage
Beer - the love catalystgood ol' homepage

This topic is closed to new replies.

Advertisement