Animated Textures

I would like to do some animated texture effects. The animated pictures are already there, so I need to load them in and show them continuously at real time.

What would be the best way to do this?
Using one big texture and adjust the texture coords you can not use repeating!!!
You have to stretch the texture over all the polygon.

Loding all frames into Video memory using glBind would be expensive bubt fast.

Using glTexSub image to copy part of a larger texture into a smaller tex object uses less texture memory but you have to upload the texture from memory
which is slow for NVidia HW.

… I am confused. What would be the best solution.


If you have a small number of frames, putting them all in one texture and offsetting the texture coords would be the most efficient solution. Otherwise you’ll have to use 'subImage to avoid wasting texture memory - I believe it’s best to have two dynamic textures instead of one, so you update one while rendering the other.

-You could even use both schemes together as some sort of complicated caching scheme.

Hope that helps.

[This message has been edited by UncleBuck (edited 12-12-2000).]

“Better” – in what sense?

Putting all the textures in texture memory
is the fastest, as long as you have the

If you don’t have the memory, you WILL have
to keep uploading the textures, no matter

Also, if you NEED tiling, putting the
frames all in one texture just won’t work
for you, so it’s not even an option. If you
don’t need tiling, why worry about it?

And putting all the textures in one big
texture and changing coordinates may still
use the same amount of memory (more or less)
as putting each frame in its own texture;
after all, it’s the same data (modulo some
per-texture overhead). Assuming you only need
one frame per frame, there won’t be any
binding overhead just splitting the textures

Choose whichever works best for you.

im guessing stick all the frames in one texture is gonna be a speed lose? after all when u animate u only display one frame at a time

Sticking all the frames in one texture wouldn’t neccessarily be a speed loss, it depends on the other textures in memory and the amount of texture memory. Assuming all textures fitted in the cards memory I don’t think it would be any slower - but could lead to artifacts (Due to filtering) unless you have a black border around each frame.

For convienience I agree it would be simpler/nicer to have each frame in its own texture but if you have a batch of surfaces to be drawn with the same animated texture then packing them all into one texture would possibly be more efficient (If everything fitted in memory) as you eliminate texture changes.

Personally I’d use two textures per animated texture and upload the next frame in one of the textures while rendering using the other - and of course try to keep the texture sizes as small as possible.