Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / Creating an animation sprite class to play an AVI from memory....!? Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

May 28, 2005, 08:34 AM

Hello... I have been using AVI's with alpha channels for some fire effects in my GUI. Unfortunately I have just implemented a new paging system to take resources in and out of memory in the background on worker threads and I have run into problems.

Because DirectShow does not load the entire AVI into memory it means that the HD is constantly in use, when the worker threads start loading things off the hard disk I start getting jumpy performance.

Therefore I thought it might be a good idea to make an animated sprite class which could load a texture containing all the frames of the fire animation into memory and render them in turn without having to access the hard disk.

I have a couple of questions before I start though...

The animations in question are 64 frames long and each frame is 100x215x32.

I had planned to arrange the the frames in an 8x8 grid in the texture file giving me a 800x1720x32 texture, or 44032 kbytes (44mb).

And now for a couple of questions.

1. Does anybody think this is a crazy stupid idea? And if so do you have any better ideas?
2. Does anybody know of any way of automating the process of aligning 64 frames into a big texture so that I don't have to spend 4 hours in front of Photoshop.

Thanks in advance.

Mark Coleman

Julio Gorgé

May 28, 2005, 08:48 AM

1. Why don't you keep an image of the original AVI in memory? In compressed form, I mean. I don't know if DirectShow can play a video stream from memory though(I guess it is possible). This is how ogg/mp3 files are handled in most software applications.

2. Do it programatically.. only faster than Photoshopping if you already have experience with Python or Perl. Both languages have image handling modules.


May 28, 2005, 08:51 AM

Thanks Julio.

I am not sure about keeping the AVI in memory, I will have a look and see what I can find out.

As for programatically creating the texture, it would take me longer to dust off my Perl than to do it manually... It's been a while since I did any Perl and even then I didn't use an imaging library!

Mark Coleman

This thread contains 3 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.