[SDL] Question about texture size

David Olofson david.olofson at reologica.se
Thu Jul 4 13:01:00 PDT 2002

On Thu, 4/07/2002 12:07:03 , Atrix Wolfe <Atrix2 at cox.net> wrote:
>why not just have several 256x256 textures and keep track of which has what?

Now that you mention it...

>Unless theres some reason why you can only use a single texture it seems
>like that would be a pretty ok way to go, the code would just be a little
>bit more complicated (a very weee bit).

..there's an even simpler way than what I proposed, which probably
worst just as well, at least if you use some serious graphics. (By
"serious graphics", I mean artwork that makes the levels look more
like large pictures than tiled maps. Lots of tiles that are crafted
to fit perfectly together to form larger objects, that is.)

Just put tiles that are normally used together on the same texture.
Then do the obvious

    if(texture != current_texture)
        current_texture = texture;

inside the plain "render all tiles on screen" loop.

You may improve things further by not rendering row by row, but
rather in blocks of 4x4 tiles or something. (In the average case,
I'd think a 4x4 area is more likely to contain mostly "related"
tiles than a 16x1 area.)


| David Olofson
| Programmer
| david.olofson at reologica.se
| Address:
| REOLOGICA Instruments AB
| Scheelevägen 30
| 223 63 LUND
| Sweden
| Phone: 046-12 77 60
| Fax: 046-12 50 57
| Mobil: 
| E-mail: david.olofson at reologica.se
| WWW: http://www.reologica.se
`-----> We Make Rheology Real

More information about the SDL mailing list