[SDL] Surface vs Texture - optimal usage

Jared Maddox absinthdraco at gmail.com
Sat Oct 26 19:36:00 PDT 2013


> Date: Sun, 27 Oct 2013 00:49:13 +0000
> From: "mattbentley" <mattreecebentley at gmail.com>
> To: sdl at lists.libsdl.org
> Subject: Re: [SDL] Surface vs Texture - optimal usage
> Message-ID: <1382834953.m2f.40207 at forums.libsdl.org>
> Content-Type: text/plain; charset="iso-8859-1"
>

> I have two main case scenarios:
> 1. Using large prerendered backgrounds which scroll.
> 2. Using multiple copies of the same sprite, but at different phases of
> their walk-cycle, ie. different textures.
>
> Given that it's not making multiple renders of the same texture, would
> texture atlasing speed anything up in this case?
>

At the moment, probably not (though if you have enough textures for
them to spill out of GPU memory into wherever else the driver can
store them, then maybe so: that particular sub-case lends itself to
corner-cases), but I advise implementing support anyways. The support
should be quite cheap (both in implementation effort and in
maintenance/support), and implementing right at the start should save
you from ever having to do a lot of unexpected changes later on.

Also, it can make it easier to deal with sprites if they're all in the
same file, so you'll be wanting this sooner or later anyways. Doubly
so if someone else winds up using the same engine later.

Still, there is a limit on how much this can help right now (and it's
a pretty massive limit). If someone gets around to implementing a
MultiRender function then you'll be in a position to benefit
massively, but for the moment it buys you little, when it buys you
anything.



More information about the SDL mailing list