iPhone OpenGL-如何渐变淡出纹理? [英] iPhone OpenGL - How to gradient fade out a texture?

查看:155
本文介绍了iPhone OpenGL-如何渐变淡出纹理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义FlowCover(覆盖流程重制)示例代码的反射.现在,反射(纹理)只是透明的,但我希望它具有渐变,以便纹理淡化为完全透明.

I want to customize the reflection from the FlowCover (Cover Flow remake) sample code. Now, the reflection (a texture) is only transparent but I want it to have a gradient so that the texture fades to be completely transparent.

您如何使用OpenGL达到这种效果?这是处理纹理的代码.

How would you achieve this effect with OpenGL? This is the code that handles the textures.

glPushMatrix();
glBindTexture(GL_TEXTURE_2D,fcr.texture);
glTranslatef(trans, 0, 0);
glScalef(sc,sc,1.0);
glMultMatrixf(m);
glDrawArrays(GL_TRIANGLE_STRIP,0,4);

// reflect
glTranslatef(0,-2,0);
glScalef(1,-1,1);
glColor4f(0.5,0.5,0.5,0.5);
glDrawArrays(GL_TRIANGLE_STRIP,0,4);
glColor4f(1,1,1,1);

glPopMatrix();

欢迎任何提示或关键词.

Any hints or key words are welcome.

非常感谢.

推荐答案

我对此问题的解决方案是删除openGL反射并将具有反射和渐变的图像路径传递到FlowCower. 此处是创建图像反射的一个很好的例子.

My solution to this problem was to remove openGL reflection and to path image with reflection and gradient to FlowCower. Here is a nice example on creating image reflection.

这篇关于iPhone OpenGL-如何渐变淡出纹理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆