[SDL] tga file loading ...

Steve Madsen steve at h2eye.com
Fri Apr 28 01:06:42 PDT 2000


At 17:14 28/04/00 +1200, you wrote:
>Does anyone here know how to load a tga into a SDL surface?
>the sdl image lib doesnt seem to have it ...
How many images do you have?  Set up a GIMP script to convert your
TGAs to PNG and you'll be all set, with smaller (lossless compression)
files which are still 32 bpp with full alpha support--and SDL is ready
to go.

If you simply must use TGA then have a look at the SDL_image library
and modify one of the extant files to load TGAs.  Depending on how
familiar you are with TGAs, and the level of support you need to provide,
this could take two days or five weeks--it's
not as simple as merely modifying a few variables; the extant format
loaders will only serve as a guide to the procedure.  You'll need to go
surfing and find the spec for TGA files and build in support for any tags
you need, make sure you take care of big/little endian byte order, etc.

I modified SDL_image to load TIFFs (using libtiff, which made life much
easier but still not _that_ easy) but ended up going with PNGs in the end.


Steve Madsen
H2Eye Ltd.
24-28 Hatton Wall
London  EC1N 8JH
UNITED KINGDOM (UK)
Tel:   +44 (0) 207 404 9600
Fax:   +44 (0) 207 404 9490
Email: steve at h2eye.com





More information about the SDL mailing list