# Make sprite animation

**URL:** https://discourse.libcinder.org/t/make-sprite-animation/1411
**Category:** Using Cinder
**Created:** [January 25, 2019, 10:55am UTC](https://discourse.libcinder.org/t/make-sprite-animation/1411 "2019-01-25T10:55:13Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![sharkbox](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/sharkbox/32/39_2.png) [@sharkbox](https://discourse.libcinder.org/u/sharkbox)
#### Post date: [January 28, 2019, 9:14pm UTC](https://discourse.libcinder.org/t/make-sprite-animation/1411/3 "2019-01-28T21:14:13Z")

</div>

There are a bunch of great ways to do it. Using a spritesheet is definitely one of them. An advantage of something like a spritesheet is that when openGL binds a texture, it only has to do it once per frame, and not multiple times for different textures. This is especially helpful if you have a lot of instances of the same sprite on screen at once.

In the past when I’ve needed to bind a lot of textures and needed great performance, I’ve used 2D sampler arrays. These will let you pass in “3D” arrays of textures, and I think on my system I can pass up to 2048. `GL_TEXTURE_2D_ARRAY` is the thing to google. You’ll need to write a custom shader, and then in the texture lookup, you pass in a vec3 instead of a vec2, where the `z` is an index for which texture you’re looking up.

Lastly, a while back I made a simple block for animated gifs. [New block - ciAnimatedGif](https://discourse.libcinder.org/t/new-block-cianimatedgif/301) Depending on your app structure and performance needs, this can also work in a pinch.

TLDR: Try spritesheets, and gifs in that order. If you need performance, check out `GL_TEXTURE_2D_ARRAY`.

---

_[View the full topic](https://discourse.libcinder.org/t/make-sprite-animation/1411)._
