views:

145

answers:

3

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.

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.

Thanks a lot.

+1  A: 

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.

eviltrue
+1  A: 

It's a good idea to draw reflection with gradient way. ^_^

I think you can put a light source, and change the normal vector of project view. The lighting source will make some gradient effect.

Toro
+1  A: 

You might want to look into multitexturing. You can combine the base texture with a gradient texture in a way that uses the color of the first and the alpha values of the second. Take a look at the glTexEnvi command.

whooops