SDL_image and unknown targa

I try to open targa-files with SDL_image’s IMG_Load, but it gives the
error: unknown image format. Jpeg, pcx and bmp seem to work fine(haven’t
tested others). Is there a missing library or something?

Juhana Lehtiniemi wrote:

I try to open targa-files with SDL_image’s IMG_Load, but it gives the
error: unknown image format. Jpeg, pcx and bmp seem to work fine(haven’t
tested others). Is there a missing library or something?

No extra library should be required, but since TGA files do not have
an identifying header, the file name must have the extension .tga or .TGA.
Please send me the file (by mail, or even better put it somewhere and give
me an URL) and I will have a look

[ CC:ed to the sdl-list ]

lehtini2 at students.cc.tut.fi wrote:

No alpha blending by hardware? Do you know, is that on to-do-list?

definitely, though far from all hardware can do it

What do
you think in general, is SDL good for fast scrolling 2d-shoot’em up?

I’d like to make it the best possible for it, but at the moment some
things are lacking. The problem with scrollers is that the entire screen
must be updated each frame and that’s expensive when using software surfaces.
Use as low resolution and colour depth as possible to avoid this

I think
I should leave alpha blending out them, because it makes things a lot slower.

It’s not so bad if you are using software surfaces (especially if you use
RLE), but combines badly with hardware acceleration. Measure and see.

And one more question… how would you code a fullscreen scrolling: redraw
full screen on every tick, or have backbuffer for every image that I draw
on screen and then read the backbuffer onto screen after drawing, for each
image of course. And then move the part of the scrolled image that is on
the screen and draw the rest?

If hardware surfaces and accelerated blitting are available, this is fast
enough to redraw everything every frame. Then you can take advantage of
refresh-synchronised page-flipping which is very nice for scrollers.

If only software surfaces are available, there are various tricks that
unfortunately cannot be done in SDL right now (involve updating from offsets
of the back buffer), but the only good advice then is to keep the amount
of data as low as possible. On the other hand, you get to do as much
alpha blending as your CPU can take.

Many good “scrolling” games can be done without scrolling the entire screen,
but by moving background objects (such as stars) so the screen appears to be
scrolling. This is a good deal faster since it can avoid a full-screen update
every frame

And about that transparency… there was a possibility to define
only one transparent color instead of alpha blending?

that’s called colour-keyed blits