AUX_RGBImageRec to file
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]]=--
thats clear
but how can i write the data to a file?
i want to create texture archive like the wad files in hl
but how can i write the data to a file?
i want to create texture archive like the wad files in hl
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
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
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 catalyst
good ol'' homepage
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement