[SDL] tga file loading ...

Oliver Batchelor shadows at ihug.co.nz
Fri Apr 28 03:16:47 PDT 2000

Hmm I was using an app to generate hieght fields and it outputs the
files as 16 bit tgas (terraform)
It instead of putting the usual rgb info in eg 5,6,5 for each color
it just puts all 16 bits for the height of that part of terrain ...
If I use gimp to convert tga->png would it mess all that up ?


On Fri, 28 Apr 2000, you wrote:
> 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
> Tel:   +44 (0) 207 404 9600
> Fax:   +44 (0) 207 404 9490
> Email: steve at h2eye.com

More information about the SDL mailing list