Jump to content
  • Advertisement

Archived

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

saeZ

Blending black

This topic is 5922 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!