Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (517)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (578)
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 507 times)
0 Members and 1 Guest are viewing this topic.
Offline wessles

JGO Wizard


Medals: 67
Projects: 4
Exp: 3 years


Profile picture isn't relevant.


« 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,
-wes

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 Wizard


Medals: 67
Projects: 4
Exp: 3 years


Profile picture isn't relevant.


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

-wes

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline opiop65

JGO Kernel


Medals: 156
Projects: 7
Exp: 3 years


JumpButton Studios


« 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 Knight


Medals: 14


falling into the abyss of reality


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

.mng would be a better choice.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline noblemaster

JGO Ninja


Medals: 20
Projects: 10


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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

DarkCart (15 views)
2014-10-31 21:44:48

DarkCart (19 views)
2014-10-31 21:43:57

TehJavaDev (40 views)
2014-10-27 03:28:38

TehJavaDev (30 views)
2014-10-27 03:27:51

DarkCart (44 views)
2014-10-26 19:37:11

Luminem (27 views)
2014-10-26 10:17:50

Luminem (30 views)
2014-10-26 10:14:04

theagentd (36 views)
2014-10-25 15:46:29

Longarmx (64 views)
2014-10-17 03:59:02

Norakomi (62 views)
2014-10-16 15:22:06
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!