I need to render an image on top of a background in OpenGL and I'm trying to get the same result as the "Color Dodge" in Photoshop but I'm not able to do it.
Right now I'm doing:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
// background
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, background);
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(0.0, 0.0);
...
glEnd();
glDisable(GL_TEXTURE_2D);
// image
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, image);
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(0.0, 0.0);
...
glEnd();
glDisable(GL_TEXTURE_2D);
The background is a tga with no alpha channel. The image is a tga with alpha channel.
This renders the image with alpha on the background but way too bright.
I read that it should be as easy as:
glBlendFunc(GL_ONE, GL_ONE);
But the image despite of having alpha channel gets rendered as a white square.
Clearly I'm doing something wrong.
You're not going to be able to use blending to get the equivalent of the Photoshop "Color Dodge" effect. It's a more complicated mathematical function than can be expressed using standard blending logic. So you're going to have to come up with some programmatic blending methodology to make it work.