Hello Everyone!

I'm using C++ to write a small 2D app with SDL and OpenGL. I'm trying as much as possible to keep my code cross-platform. However, I've hit a bump. I can't find a good, easy way to display text on the screen. I am able to do it, but not the way I would like to.
I've tried using the built in bitmapped fonts OpenGL has, but that doesn't give me much control over fonts, sizes, and orientation.
Right now, I'm using SDL_ttf to create an SDL_Surface with my text. From there, I tried two things.
First, I tried creating an opengl texture with the text. This gives me lots of control over it, but the font rarely pixelizes exactly, and it becomes blurry and hard to read, and the font always has a background color. I can't just render ONLY the font.
Second, I tried calling glDrawPixels(...) on the SDL_Surface I got when generating my text. This approach pixelizes correctly, but it brings back the bitmapped font problem: no control over size and color. And for some reason, I can't render my fonts on top of opengl polygons. On background, the fonts are clear and visible, but the polygons seem to cover them up.
I know that OpenGL doesn't have a built in facility to render fonts. So could anyone recommend a good library for me to render True Type Fonts with OpenGL WITHOUT RENDERING THEM TO A SURFACE/TEXTURE?
And please don't suggest FTGL or its relatives. I tried it, and it failed to compile because of an error in the header.

Did you try google? There seem to be a lot of hits relating to this. http://www.google.ca/search?q=sdl_ttf+opengl

You can use SDL_ttf's TTF_RenderText_Blended to get smoothed SDL text surfaces. I don't know how to convert them for use in OpenGL from there, unfortunately. I think you should be able to find this information online, though.

It's always annoyed me that SDL_ttf creates new SDL_Surfaces every time. I haven't found a good way to get TrueType text without using it, though. If you're okay with bitmap fonts, you can use SDL_gfx's font code or roll your own (as I did in sailseas). I think the SGE also has support for bitmap fonts, you'd have to check.

Thanks for the suggestion, but I'm trying to stay AWAY from bitmapped fonts. I know for certain that it is posible to render TTF fonts in OpenGL as polygons. I've seen it done. One library that has this capability is FTGL, but I can't get that particular library to work.
This is why I'm asking for alternatives.

Can anyone recommend a library that renders True Type Fonts as POLYGONS in OpenGL? Polygons meaning I can color it, scale and transform it to my will as I can with ANY OpenGL polygon? Something that doesn't require me to generate textures, blit surfaces, or prerender fonts! I want to work with SHAPES that look like the font I'm loading. NOT BITMAPS, NOT TEXTURES, NOT SURFACES. POLYGONS! GROUPS OF VERTEXES IN 3D SPACE!

Hi Zcool131, I've seen on the net somwhere to how on getting text to screen with SDL. Im presently in the middle of working in that area. I have tried different aspects to SDL_ttf and found one video where somehow they got text to render right to the screen. But on my efforts Im trying to get text and menus working in the SDL format. I find SDL very flexiable in many ways. And noticed that its a great game engine to use.

This article has been dead for over six months. Start a new discussion instead.