Blending Bitmap Fonts, Retain Antialiasing?


I prerendered some fonts with the angelcode font tool.

To Blend against a chosen colour (in this example white) I use the following code:

gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);

gl.uniform4f(TshaderProgram.colorUniform, 1, 1, 1, 0.5);

My Fragmentshader:

uniform vec4 uColor; //is TshaderProgram.colorUniform

void main(void) {
gl_FragColor = textureColor * uColor;

The Problem is that my original generated texture font has a smooth transition from the outlines of the single chars to the center of each char, meaning the chars are antialiased. With my implementation of the blending I lose that, meaning the antialiased soft grey areas in the charakter will simply be converted to white. So now the font in my program has ugly edges. What am I doing wrong here?

Best regards, S.

What texture format are you using?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.