Original Post
Ok, i found out that glaux implementation of auxDIBImageLoad on lcc(version 3.3) is buggy, and doesn't work on Win 2000, generating general protection faults.(Tried to compile Nehe's lesson 06, and it did compiled but got gpfs.. the .exe that comes with the sources doesn't. I guessed it has to do with the compiler).
So I, in my all boreness and inspiration, tried to implement a 256px x 256 px image loader. It didn't worked either... and I dont know C memory management very well... can someone help me on this one?(i am actually not interested if the image is DIB or RGB or RGBA, I want the damn thing to at least open garbage texture that are 192kbyte longer. i'll cope with that later
)(the code is *really* inspired on Nehe's lesson 06)
thats the idea, but i get error at the first memset(wondering if general programming would be the best place to ask it rather.
)
[edited by - guitarplayer on December 13, 2002 3:50:16 PM]
AUX_RGBImageRec * LoadBMP(char * name)
{
FILE * file=NULL;
AUX_RGBImageRec * result=NULL;
unsigned char data[256*256*3];
memset(result,0,sizeof(AUX_RGBImageRec *)); //
if(!nome)
{
return NULL;
}
arquivo=fopen(nome,"rb");
if(arquivo)
{
memset(result->data,0,sizeof(arquivo));
for(int i = 0; i<sizeof(arquivo);i++)
fscanf(arquivo,"%uc",data[i]);
for(int i = 0; i<sizeof(arquivo);i++)
result->data[i]=data[i];
result->sizeX=256;
result->sizeY=256;
return result;
}
return NULL;
}