Animated texture

I have a textured sprite that I would like to cycle repeatedly though 4 frames of animation. Is there a preferred way of doing this Code samples (or even a link) would greatly appreciated, since I have not tried this before.


Answer this question

Animated texture

  • srinivas vasireddy

    A more uncommon alternative would be to use a volume texture, in which you can store the frames of your animation in the z-slices of the texture. For 4 frames this might not be too useful, but if you are considering using more frames later on this might be the way to go. You can find a some more info and an example implementation of this over here on mdxinfo.



  • Steve Cook

    I'd agree with ZMan on this one.
    I would suggest with going with option 2 of what ZMan suggested as far as what you want to do goes. It's definitely computationaly the more inexpensive one.

    I hope this helps.
    Take care.


  • JamesHeiser

    You have 2 choices

    1. Change the texture each time and keep the texture coordinates the same

    2. Change the texture coordinates to pick up a different bitmap in the texture map

    I think #2 is used more often than #1

    See the Simple2D sample in the SDK (only in managed code)



  • venkyweb

    This makes total sense; I've seen open source games before that stored all the frames of animation for a given character in one picture; now I understand why!

    Thanks for your input!



  • Animated texture