Animated GIF on iPhone using OpenGL and GifLib
I am trying to get animated gif to work on iPhone. I searched on Google, had found some useful information from this blog ...
http://www.cuppadev.co.uk/playing-animated-gifs-on-the-iphone
The animations that I try to play is not with simple flipbook style, so I decided to give OpenGL and GifLib a try. I grabbed the code from
https://github.com/jamesu/glgif
This works well with gif without transparent backgrounds, but unfortunately most of my gif files are with transparent background. I am new to OpenGL, I tried to add few lines within the playView function in PlayerView.mm. Something like..
glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, GL_MODULATE);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
But still couldn't remove the white background... I am looking for ways to play animated GIF with transparent background, any help or hint would be greatly appreciated. Thank you for your help! :)
glgif supports transparent bg gif now. https://github.com/jamesu/glgif
链接地址: http://www.djcxy.com/p/34000.html