Drawing text with shadow in OpenGL + FTGL -
i'm drawing text in opengl using ftgl library , works fine, add shadow text. tried drawing same text black color , draw text above normal color (pseudocode):
glcolor3f(0, 0, 0); // outline color drawtext(x-1, y-1, str); drawtext(x+1, y-1, str); drawtext(x+1, y+1, str); drawtext(x-1, y+1, str); glcolor3f(1, 1, 1); // primary color drawtext(x,y,str);
but have draw text 5 times , still not good.
i on screenshot
there lot of ways achieve - higher quality others.
here's do:
- render text in-memory grayscale pixmap.
- perform gaussian blur on (probably using fast library such qimageblitz or imagemagick). blur radius should 2-3px.
apply steep tone-curve blurred image, luminance range [0.0, 0.9] mapped 0.0. makes stop being blurry, , result "fattened" version of text. tone curve should this:
- render shadow, in black (using appropriate blending mode emulate alpha-blending). render regular yellow text on top of (with small offset of choice).
also, can use different tone-curves depending on how soft shadow want. linear tone-curve give soft shadow.
Comments
Post a Comment