1

I have a problem with blending text. It's not only text problem but global blending problem with alpha value.

I tried 2 different blending function on image (text is image too). Function glBlend with different first parameter. (I know how glBlend func works)

Blend samples

There are black pixels around the text and it's around every alpha image with smooth alpha edges. It doesn't seem good with the text :/

The result with parameter GL_ONE is exactly what I want but I can't make text fade with alpha value.

So the question is:

Is there any way how to get result from GL_ONE parameter with using source alpha value of the image?

With this parameter source alpha of image isn't used so it can't be transparent. I want to animate the image like this:

enter image description here

I need to use GL_SRC_ALPHA function because I need to use source alpha. I tried to increase the color values with fragment shader so the result is similar to GL_ONE blending but I don't want to change original colors.

Any help? Thanks.

EDIT: There is page with blending functions you can try it and better understand what I mean:

http://www.andersriggelsen.dk/glblendfunc.php

eSeverus
  • 552
  • 1
  • 6
  • 18
  • This is the entire reason pre-multiplied alpha was created. The RGB color of your image is modulated by the alpha component when the image is created. Then you can use `GL_ONE` to do the same thing as the following blend source factor: `Src.rgba * Src.a` (`GL_SRC_ALPHA`). You still need to keep the source alpha around though, because it is used for the destination blend factor. – Andon M. Coleman Jun 01 '14 at 22:41
  • Thank you for solution you are right, but it's not comfortable for my system. Text image is created only once, for saving performance and graphic card, and then it's used several times with scaled alpha value. It's the same, but in reverse order. Is it possible to do it with pre-created image? – eSeverus Jun 04 '14 at 08:48

0 Answers0