How do you fade (alpha fade) an object in/out? (like a klingon ship does).
The only way I could do this, is to take the textures and modify the alpha channel and resend the textures to the video memory each frame. But this would be very slow.
Is there a way to effect the overall alpha attribute of a texture at render time?
Try the last parameter in glColor4f
will produce artifacts imho (hidden polygons popping-up)
How about this: disable color (keep depth-test and depth-write enabled), draw your object. And then enable color and draw the object the way zeoverlord mentioned. Just draw your object last (after background and things that could be behind it) ^^
But i’m using textures, does glColor4f still apply? I thought that was just for solid color materials.
if your texture environment mode is set to GL_MODULATE (which is the default) the color from glColor4f() will modulate the texture value. So for
and a texture value of
0.5f , 0.25f , 0.75f , 1.0f
the output will be
0.5f1.0f , 0.25f1.0f , 0.75f1.0f , 1.0f0.25f
0.5f , 0.25f , 0.75f , 0.25f
Ok, I got it working. I had to call glEnable(GL_COLOR_MATERIAL) but now my lighting is not working. Everything is bright. I have a maze with lamps in the corners, but once I enable GL_COLOR_MATERIAL everything is just bright (ignores my lights).
Any ideas why?
I got it all working now. Seems that when you enable GL_COLOR_MATERIAL that lights are 10x brighter. I’ve adjusted values and everything works.
Thanks to all for fast help.