Blending black

Started by
1 comment, last by saeZ 22 years ago
I''ll make this short and simple. Here''s a code snippet: glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glColor3f(1.0f, 1.0f, 1.0f); That snippet renders a particle using a grayscale bitmap where white is brightest and black is transparent. Sure, works fine for bright light particles, but how do I make the thing work in other way around; white is transparent, black is darkest? I want to make simple shadows and smoke particles with this method. Thank you. saeZ
Advertisement
you want to use
glBlendFunc(GL_DEST_ALPHA, GL_SRC_ALPHA);

not usre if thats the correct way of puutin it, but you want to set your dest blend to the source (particle) alpha, and the source blend to one. that shoudl work.

another way could be to set dest blend to zero and src blend to dest color (assumes the particle is a grascale image).

you could have dest blend one and source blend as srcalpha.

or maybe dest blend invsrcalpha and source blend as srcalpha.

play around with those methods, and one should get the look you want. also look up mulitplitive or subtractive blending on google.
Thanks.

I got the thing working. It goes like this:

glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
glColor4f(1.0f, 1.0f, 1.0f, 0.0f);

Works perfectly!

saezee

This topic is closed to new replies.

Advertisement