Outlined OpenGl text like Google earth

Please is there a library or facility to draw outlined text like Google earth does ?

(Please tell me even if you know a commercial library)

Thank you in advance.

try (windows only) wglusefontoutlines

Hi thanks so much, ok but i did not try this yet, but i looked into sample code and could not see a parameter specifying the extra color for the font outline.

after examination i concluded the function name is illusionary

that’s not true. with that func i can create wonderful things like these.

try using the func combining WGL_FONT_POLYGONS with WGL_FONT_LINES and there u can have your font outline

Draw the text 2 times (actually 9 or 10)
first, 8 or 9 times with black color, and offsets {-1;0;1} pixels
then, finally draw the text in white color.


void DrawShadowed(int x,int y,const char* text){


void DrawShadowed(int x,int y,const char* text){
	for(int i=-1;i<=1;i++)
		for(int j=-1;j<=1;j++)

Alternatives use blurred versions of the font-texture, or precalculated outlined font-textures (which don’t look good sometimes)

If you want to use font textures, you should read this paper:


With a simple fragment shader you can render the interior and the outlines in a single pass.

You can render text glyphs using textured quads with (premultiplied) alpha blending. You need separate alpha and colour (or luminance) channels. Texels that are “in” the glyph you can have white colour and alpha 1.0. At outline you can have black colour, alpha 1.0. Beyond outline, where you should see through, have colour black, alpha 0.0.

You can generate this kind of font textures easily with a free tool from here: http://www.angelcode.com/products/bmfont/

Premultiplied alpha? Sorry, but Valve wins. They’re stuff is so far beyond premultiplied alpha that it’s not funny.

Jesus Christ! I am still struggling to make the text show up at a specific 3 position. Too impatient to see what it can give.

the text pictures in that document are just so crazy!
But with no source code or example applications I can inspire from, it makes me just more sad.

If you ONLY want render text like in the google earth’s image, use a bitmap with all characters into. It’s far the easiest, faster (and simplest) way to render text, moreover if you have to render tons of characters. Dont try a very high quality and gpu eater method if you dont need to.

This way doesn’t even need shaders, so it’s up to choose a fast or a HQ method. It depends on your needs.