glColor4f and glBlendFunc for fading to white?
hey everyone, potentially dumb question alert...
i know how to use glColor4f to get a texture to fade to black, or fade to pretty much any color, except white... my images are not greyscale, they have their own color information..
so let's say I want an enemy to flash white when it gets damaged or something. clearly color4f (1,1,1,1) just gives the texture all its proper colors... i think there may be something i can tweak with glBlendFunc to get the effect i want, but...
I'm sure this has a relatively easy solution..
i know how to use glColor4f to get a texture to fade to black, or fade to pretty much any color, except white... my images are not greyscale, they have their own color information..
so let's say I want an enemy to flash white when it gets damaged or something. clearly color4f (1,1,1,1) just gives the texture all its proper colors... i think there may be something i can tweak with glBlendFunc to get the effect i want, but...
I'm sure this has a relatively easy solution..
Disable GL TEXTURE 2D and just draw it white?
"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Lurie's solution works if you're doing 3d models - but if you're doing billboarded sprites, it won't. In that case, your only solution (that I know of) is to have the sprites duplicated with only the alpha information filled out, all the color channels white. Perhaps you could find a way with glBlendFunc?
I can think of two sort-of good solutions.
1) Use the additive texture environment function instead of modulate.
2) Do some finagling so that your sprite's alpha mask is drawn into the framebuffer and then blend a colored quad over the top of that using the framebuffer alpha as the mask.
I might fiddle around with this tonight.
1) Use the additive texture environment function instead of modulate.
2) Do some finagling so that your sprite's alpha mask is drawn into the framebuffer and then blend a colored quad over the top of that using the framebuffer alpha as the mask.
I might fiddle around with this tonight.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Using blending for a text fading effect. | cjcaufield | 2 | 3,493 |
Jun 30, 2010 08:21 PM Last Post: cjcaufield |
|
| glColor4f not working after glDrawArrays | Technoman | 2 | 4,642 |
Aug 15, 2009 08:09 AM Last Post: Technoman |
|
| glBlendFunc | leRiCl | 3 | 3,568 |
Jul 10, 2008 06:49 AM Last Post: aarku |
|
| Cocoa loaded textures have white edges | Jake | 6 | 3,712 |
May 6, 2005 09:17 AM Last Post: Jake |
|
| White screen problem | Iceman | 7 | 3,618 |
Mar 31, 2005 10:41 PM Last Post: OneSadCookie |
|

