PDA

View Full Version : Blending Bitmap Fonts, Retain Antialiasing?



11&2
02-10-2011, 02:38 PM
Hi,

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.enable(gl.BLEND);

gl.useProgram(TshaderProgram);
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.

Xmas
02-14-2011, 05:53 AM
What texture format are you using?