View Full Version : Outlined OpenGl text like Google earth

06-27-2011, 01:33 AM
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.

06-27-2011, 02:56 AM
try (windows only) wglusefontoutlines

06-28-2011, 02:47 AM
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

06-28-2011, 05:42 AM
that's not true. with that func i can create wonderful things like these.

06-28-2011, 05:45 AM
try using the func combining WGL_FONT_POLYGONS with WGL_FONT_LINES and there u can have your font outline

Ilian Dinev
06-28-2011, 01:47 PM
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)

06-28-2011, 11:33 PM
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.

06-29-2011, 02:31 AM
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/

Alfonse Reinheart
06-29-2011, 04:26 AM
Premultiplied alpha? Sorry, but Valve wins. They're stuff is so far beyond premultiplied alpha that it's not funny.

07-01-2011, 05:45 AM
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.

07-01-2011, 05:47 AM
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.

07-03-2011, 12:29 PM
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.