I had an idea involving .gifs!

So, you know how if you want to store an animation, you can either store multiple frames on an image or create your own format? Well what if we took frames from .gifs? This obviously has some flaws (lack of color scale), but it would be a novel thing to be able to load an animation from a .gif.

Just a thought,
-wes

OpenGL doesn’t know what a GIF is, it just understands textures. If you pack each frame into a single texture, you can utilize sprite batching to reduce draw calls and improve performance. Using a different texture for each frame is not as optimal.

Some desktops support “texture arrays” which could work with GIFs, but at that point you may as well just have an image sequence so you can take advantage of full 32-bit color.

Artists are pretty used to exporting image sequences; tools like Maya and After Effects have it built-in. New versions of AE do not even export to GIF anymore, since nobody is using it these days. :slight_smile:

Plus, with texture atlases, you can pack multiple animation sequences into the same image, which should help with filesize and load time. Another thing… with texture atlases you can trim away white space for each frame, leaving you with a much smaller overall image.

Since Java2D uses OpenGL/DirectX under the hood; the more “hardware-friendly” your rendering is, the better it should perform, in theory.

Well I’m sure you could produce a tool that would pull apart the .gif at intervals and then use pack the images into a spritesheet, and voila, you have your “GIF” in a format OpenGL can read. But really, isn’t that way too much work when you can just make the spritesheet yourself?

.mng would be a better choice.

There are a couple standalone Java classes that allow encoding and decoding to/from GIFs! Shouldn’t be hard to just replace java.awt.Image with OpenGL textures. I have done it before.

Anyhow, too lazy to look up GIF encoder/decoders for you. Just have a look what Google brings up.