🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Header Issue with PSP 9 and Les. 33

Started by
1 comment, last by PorkChop Conrad 16 years, 11 months ago
I have a slight problem... I origanally had my own code for loading Compressed / Uncompressed TGA's... Which I put together from NeHe's code from Lession 33, and some other sources I had, so it would work the my code of my whole program (Non-Window API along with some other stuff)... Anyway, I ran into a problem where it just simply wasn't loading the file. A further look into the issue, I discovered it wasn't matching headers... So... Thinking that my code was just messed up, I used NeHe's. I was origannly using the older version 7 of Paint Shop Pro... I just recently went out and bought 9... but... Both Compress and Uncompressed TGA's worked with 7, however, now when I save with the same settings on 9, neither one works... And from NeHe's and my own code (With Error Messages) it's the Header... I'm not sure what's going on, if 9 for some reason isn't saving a header... or if it uses a newer vesion of a TGA format (which I looked up and didn't find anything)... But anywho... Anyone else have this problem? Do I have a bad copy of PSP? Is there something I'm over looking? or somethin else? THanks ahead of time if anyone can help.
Advertisement
the problem is that the tga format has something called a id header, it's basicaly a string from 0-255 bytes that could contain anything.
Now the original NeHe code doesn't contain the code to either read or skip that since it was largly unused.
Until PSP9 that is, it has a habbit of placing all kinds of data in there including the id header.
to solve it add this to the top


char tgaID[256]; // TGA header

and this

if(tgaheader[0]!=0)
{
if(fread(&tgaID, tgaheader[0], 1, fTGA) == 0) // Read TGA header
{
lg.out(CF_ERROR,"Could not read tga ID");
if(fTGA != NULL) // if file is still open
{
fclose(fTGA); // Close it
}
return false; // Return fail
}
}

just before this

texture->type = GL_RGB;
hmm, I've been running through the code, making a few changes, and I still can't get it to work... I can get the code to run through, but it still says it's not a Compressed TGA...

If it helps any, I'm using MSVS C++ with GLUT...

As I said.. I just can't get it to work right I guess... I've also just kinda skipped it all and just tried running my compressed TGA loader, and I'm still having invalid image errors...

This topic is closed to new replies.

Advertisement