Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  I had an idea involving .gifs!  (Read 1271 times)
0 Members and 1 Guest are viewing this topic.
Offline wessles

JGO Kernel

Medals: 326
Projects: 4

All coding knowledge will be useless at peak oil.

« Posted 2014-01-07 00:59:13 »

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,

Offline davedes
« Reply #1 - Posted 2014-01-07 01:25:07 »

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. Smiley

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.

Offline wessles

JGO Kernel

Medals: 326
Projects: 4

All coding knowledge will be useless at peak oil.

« Reply #2 - Posted 2014-01-07 01:37:46 »

It seems you just explained how animations work. That was not the aim here;

I didn't say I wanted to just put a gif into OpenGL, and see animation! I just wanted to just find out how to load a gif, get the frames, and patch them together for a regular texture-based animation.

The idea of this is not to create a groundbreaking new way for you to output animations, but just a fun little tool to see a .gif you found on the interwebs in your game or something.

I got this idea when I thought about splash-screens, and I wanted to show my typing-gif (left) as my splash.

Looking back, this is a really stupid post though... Tongue
this forum needs a coffee filter for stupid ideas...


Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Opiop
« Reply #3 - Posted 2014-01-07 02:13:27 »

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?
Offline Abuse

JGO Ninja

Medals: 57

falling into the abyss of reality

« Reply #4 - Posted 2014-01-07 03:23:17 »

.mng would be a better choice.
Offline noblemaster

« JGO Spiffy Duke »

Medals: 32
Projects: 11

Age of Conquest makes your day!

« Reply #5 - Posted 2014-01-07 06:32:22 »

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.

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Archive (161 views)
2017-02-27 19:41:49

numerical (505 views)
2017-02-21 07:32:16

numerical (506 views)
2017-02-21 07:31:46

theagentd (619 views)
2017-02-18 13:42:33

theagentd (614 views)
2017-02-18 13:35:16

h.pernpeintner (1786 views)
2017-01-24 22:39:11

h.pernpeintner (1727 views)
2017-01-24 22:38:32

Galdo (2299 views)
2017-01-12 13:44:09

Archive (2190 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2724 views)
2016-12-16 03:58:39
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!