FTGL Fill & Outline font

Hi,

I’m not sure whether it’s the right place to post it but anyway, to render text in OpenGL I use FTGL. There is something I have quite blurry, is it possible to have a font, and outline it with a second color to make the text appear clearly whatever the background color is ?
I only see the possibility of either outline font or filled one…

Thanks !
Thibault.

i use FTGL as well. don’t know how to make outlines but i render black text shadows before the actual text to make it distinct from the background. results in rendering the text twice with two different colors.

I have never used FTGL, but one thing that should work with any font rendering method, is to draw the same text with a secondary color with offset several times before drawing the text with primary color.

In pseudo code:

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);

That should give you a 1 pixel outline, though it will not be perfect. Better to use a textured font, which is also more efficient. I bet FTGL supports this.

its slow though because of immediate mode. having a console in my app and render up to say 500 chars with text shadows is not the best (textured). outline approximation with 5 times rendering is quite inefficient but should be tested. best solution here is to use fonts which already have outlines in them resulting in one time rendering.

Yeah, I had tried remdul’s suggestion, but the result didn’t look so great, and indeed it’s one more thing to render…
I finally chose to use two fonts. I’m drawing first the string as a FTGLPolygonFont with color1, and then the same string as a FTGLOutlineFont with color2. That gives quite a good result.
Thanks for your suggestions!