Sprites

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • I always have seen for loading sprites, people loads it all the sequence since a image. I don't know if i explain good. Instead of load each image, they load it since a complete sequence.
      I don't know how put images here. i hope you have understood me.

      The question is...using SDL, how can i do that?.
      if exist some function to implement this in SDL, i want to know it :P.
      Thanks for all
      [IMG:sprites.bmp]
      Files
      • sprites.bmp

        (43.08 kB, downloaded 824 times, last: )
      Be a pointer my friend
    • It sounds like you're trying to load a sprite sheet. I can describe the basic technique, but I have no idea how to do it in SDL or any other specific engine. There a couple of people here who use SDL so I'll let them weigh in.

      The basic idea is that you have one large texture with all of the frames of animation on it. During render time, you set the UV coordinates on the vertices to match the appropriate frame.

      The advantage is that if you're rendering a lot of the same sprite, you don't have to pay the cost of swapping textures. In fact, you can build up a nice little vertex and index buffer and render the whole thing in one render call. The disadvantage to this method is that you're generally loading really big textures. Video cards are typically optimized to store lots of smallish textures rather than several very large textures. As long as you can keep your texture sizes reasonably small (256x256 or 512x512) and keep them being power-of-2, you're probably okay.

      The other method, which is to load each frame individually, is easier to implement and doesn't suffer from the load-this-gigantic-texture issue. However, it's much harder to perform batch renders.

      -Rez
    • what i am using is frame per frame because is more easy but sometimes i have seen the other method and i wanted to compare them each other.

      My game isn't so big and i think frame per frame will be better.

      Thanks, really thanks. i'm so proud of being in this foro
      Be a pointer my friend