Original Post
hiho
i wrote a function to load .tga images
but instead of using them as texture the textures are strange mixtures of strange colors. I think that the error is with the pointer *buffer but i''m not sure. please tell me what''s wrong and woh to correct it.
The code:
void LoadGLTextures()
{
FILE *file;
unsigned char ImgInfo[6],Pixel[3];
unsigned char *buffer;
int ImgWidth,ImgHeight;
glGenTextures(maxtexture, &texture[0]);
for(int i=0;i,"r+bt");
fseek(file,12,SEEK_SET);
fread(&ImgInfo,sizeof(unsigned char),6,file);
ImgWidth=ImgInfo[0]+ImgInfo[1]*256;
ImgHeight=ImgInfo[2]+ImgInfo[3]*256;
for(int j=0;j