Loading a .TGA using NeHe's Lesson 33

Started by
4 comments, last by Kaezin 19 years, 11 months ago
I'm using NeHe's .TGA loading code and have been having some trouble getting correct formats. I have converted my old .BMP pictars into new compressed .TGA images and it seems that half of them don't work. I used Photoshop to convert them (I tried some other online programs but they didn't work either) to targas. Instead of getting the required 2 or 10 type, I've been getting types 1 or 9, usually depending on what program I used to convert it. Anyone know what the problem is? I'm thinking it's the original .BMP type that is the problem but haven't been able to verify this yet. *Edit* I converted my old bitmaps from 256 colors to 24-bit colors and they loaded successfully but now half of them just show up as white while the other half are the correct colors. [edited by - Kaezin on May 8, 2004 5:59:02 PM]
Half the people you know are below average.Trogdor the Burninator
Advertisement
Don''t use NeHe''s TGA loader. It''s given me problems in the past, too. GameTutorials.com''s is good, though.
-Ostsol
Do you have any idea what the pictures that don''t seem to load correctly have in common? Make sure that all of your files are either 24 or 32 bit and that the 32 bit files aren''t compressed (I don''t believe the code supports this).

______________________________________________________________
The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ
MySite
______________________________________________________________
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Formats______________________________________________________________________________________
Using compressed/uncompressed images doesn't make a difference as I have used both without failure. I'm creating more images so I can try to find similiarities between the ones that work and the ones that don't. I'll check out www.GameTutorials.com though.

*Edit*
Implemented Ben's TGA loader and it worked beautfully, thanks. I think the problem with NeHe's is that it is hardcoded.

[edited by - Kaezin on May 8, 2004 6:30:16 PM]
Half the people you know are below average.Trogdor the Burninator
Why not write your own TGA loader? It''s fun and informative. Check out http://netghost.narod.ru/gff/graphics/summary/tga.htm for specifications on the TGA file format (it''s not too dry, it helped me when I wrote mine).
2 + 2 = 5 for extremely large values of 2
Type 1 and 9 are color-mapped images whereas 9 is also RLE-compressed.
Killers don't end up in jailThey end up on a high-score!

This topic is closed to new replies.

Advertisement