iPhone 上使用 OpenGL 和 GifLib 的动画 GIF - 具有透明背景!
我正在尝试让 gif 动画在 iPhone 上运行。我在谷歌上搜索,从这个博客中找到了一些有用的信息...
http://www.cuppadev.co.uk/playing-animated-gifs-on-the-iphone
我尝试播放的动画不是简单的翻页书风格,所以我决定给OpenGL和GifLib尝试一下。 获取了代码,
我从https://github.com/jamesu/glgif
这对于没有透明的 gif 效果很好背景,但不幸的是我的大多数 gif 文件都是透明背景的。我是 OpenGL 新手,我尝试在 PlayerView.mm 的 playView 函数中添加几行。类似于..
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);
但仍然无法删除白色背景...我正在寻找播放具有透明背景的动画 GIF 的方法,任何帮助或提示将不胜感激。感谢您的帮助! :)
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! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
glgif 现在支持透明背景 gif。
https://github.com/jamesu/glgif
glgif supports transparent bg gif now.
https://github.com/jamesu/glgif