• Stars
    star
    123
  • Rank 288,519 (Top 6 %)
  • Language
    C
  • License
    Other
  • Created over 15 years ago
  • Updated over 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fast and comprehensive library for playing back .gif animations on the iPhone using OpenGLES

glgif

What is it?

glgif is a comprehensive library for playing back .gif animations on the iPhone using OpenGLES.

Sounds great, how do i use it?

At the core, glgif merely uploads frames from a gif animation to an OpenGLES texture. So all you need to do is the following:

// Load the gif
FILE *fp = fopen("test.gif", "r");
VideoSource *src = VideoSource_init(fp, VIDEOSOURCE_FILE);

// Init video using VideoSource
GifVideo *vid = [[GifVideo alloc] initWithSource:src inContext:[yourGLESContext]];
VideoSource_release(src);

// Set up the disposal texture
[vid setupRenderTexture];

// Setup our OpenGL context (viewFramebuffer is the frame buffer, backingWidth & backingHeight is the framebuffer size)
GLfloat projectionMatrix[16];
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(0, backingWidth, 0, backingHeight, -1, 1);
glGetFloatv(GL_PROJECTION_MATRIX, projectionMatrix);

// Tell the gif renderer where we are rendering to
vid.viewRenderInfo = TargetRenderInfoMake(viewFramebuffer, GIFRectMake(0, 0, backingWidth, backingHeight), projectionMatrix);

// Then every frame...
[vid drawNextFrame:1.0f/60.0f]; // draw in the current opengl context

Whoah, that is so complicated. Is there an easier way?

Why yes, indeed there is! An example project has been included which implements a nice OpenGLES view to display a test .gif. So all you need to do once you make a GifVideo* is:

[playerView startAnimation:vid];

Why is there a modified version of lungif?

Normally lungif will keep around decoded versions of frames. Currently glgif does not use these frames - rather it decodes frames on the fly - so there is a hack which turns off the storage of these images via generateSavedImages.

If you want to use a normal version of lungif simply uncomment the following in GifVideo.m:

if (gifinfo)
    gifinfo->generateSavedImages = false;

Do any cool iPhone applications use this code?

The only app at the moment is anim8gif.

More Repositories

1

railscollab

A Project Management and Collaboration tool inspired by Basecamp. (Semi-Discontinued)
Ruby
253
star
2

rucksack

Organisation tool written in Rails. Inspired by Backpack
Ruby
163
star
3

twackr

Twitter-style time tracking
Ruby
55
star
4

htmlcanvas

A HTML renderer using canvas... written in JavaScript!
JavaScript
45
star
5

scummc

A extended mirror of Alban Bedel's open source SCUMMC Compiler (r359 onwards)
C
38
star
6

csstransformexport

An exporter for Blender which exports scenes to HTML using CSS Transforms and Animations.
Python
33
star
7

hiscumm

Scumm Interpreter painfully written in haXe
Haxe
8
star
8

mtmobile-tools

Tools to play around with mt framework files
C
5
star
9

torqueexporter

Torque Exporter for Blender. Version here cloned from official repository for reference.
5
star
10

TribesViewer

C
5
star
11

korkscript

An embeddable version of TorqueScript
C++
5
star
12

tubehub

Anonymous Synchronized Youtube Playback!
Ruby
5
star
13

overthecam

Example camera overlay app
Objective-C
5
star
14

closet

A very scary cloest. Contains random experimental test work, and stuff which i no longer develop.
JavaScript
4
star
15

libDTShape

Library to load Torque3D DTS Shapes
C++
4
star
16

torque-stuff

My Torque Stuff
C++
3
star
17

checheche

Produces the "Che Guevara Effect". Re: https://gist.github.com/raw/1003516/71b2dc9269f2d146e9f27246e429151fa0cf05bf/Che%20Guevara%20Fy
Ruby
2
star
18

teamboxstats

Teambox Statistics Generator
Ruby
2
star
19

whatyousay

Consolidates chat logs so you know what you or they said
Ruby
2
star
20

immvertex

An implementation of the immediate mode GL api's for GLES
C
2
star
21

facemelt.js

Face melting templates for Javascript
JavaScript
1
star
22

tinyconquer

Failed entry for Ludumdare #23, provided for reference
Haxe
1
star