View Full Version : After.bmp change to .tga , the picture is smaller?

03-14-2012, 11:48 PM
I just change a picture .bmp to a .tga with photoshop ,
and I use the loadTGA() function the same as Nehe's .

but in the function
fread(texture->imageData, 1, imageSize,fTGA;) ,
the read size is smaller than imageSize .
so the texture show incorrectly .

This is what i want to ask.

03-15-2012, 12:35 AM
Make sure you create an uncompressed TGA. Most of the time, the simple tga loaders do not support compression.
Or use a proper image loading library, like freeimage etc.

03-15-2012, 03:00 AM
Thank you ~ , I has already judge the format of the tga , I 'm sure the texture is uncompressed .
What make it smaller is because I write fopen(,"r") not 'rb'.....

After I change fopen in 'rb' , the texture can show the plane , but the plane 's background is not transparent. I has use ps to make the background transparent......it shows red color, and the plane is show like a green plane .

I get puzzled....

03-15-2012, 02:26 PM
to make the image have transparency you need to add an alpha channel in photoshop, then save the image as a 32-bit TGA file.

03-15-2012, 07:42 PM
I get it !~ Thank you all !