Applying alpha gradient to an image

Started by
10 comments, last by MarkS_ 8 years, 9 months ago

After reading about the blend modes more, which I don't have much experience with, I came up with this equation:


glBlendFuncSeparate(GL_ZERO, GL_DST_COLOR, GL_SRC_ALPHA, GL_ZERO);
glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);

Testing it out on this website seems to show it working properly.

Note: The image being drawn over the framebuffer copies its alpha channel (not its greyscale colors) into the framebuffer's alpha channel. I can't make it use the source's RGB channel as the framebuffer's alpha, I don't think. I would've thought GL_SRC_COLOR instead of GL_SRC_ALPHA would've done that, but that isn't working in that preview website - it seems that when used for the alpha equation, GL_SRC_COLOR and GL_SRC_ALPHA do the exact same thing. rolleyes.gif

Advertisement

In theory I can use shaders, yes - in practise though I've shied away from them because they seem pretty complex, and I barely have a tenuous grasp on the basics at present.


I felt that way myself for quite some time, but I then decided to try out some of the tutorials that I could find online. It was a slow process to get started, but once you understand the basics, you'll never consider doing it any other way. They are complex from the standpoint that you are doing what the driver would have done for you, but there is so many possibilities that open that it becomes quite fun.

This topic is closed to new replies.

Advertisement