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.
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.
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…
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.
I get it !~ Thank you all !