Archived

This topic is now archived and is closed to further replies.

saeZ

Blending black

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites