[GRASS-dev] Re: [SoC] Weekly reports #4 wxNviz

Glynn Clements glynn at gclements.plus.com
Sat Jul 9 19:16:43 EDT 2011


Maris Nartiss wrote:

> adding coordinates can be a tricky task, as there's no single
> "de-facto" OpenGL text rendering library and such one is required to
> not reinvent the wheel. I was playing a bit around with some of them
> last spring, still had not enough time to find fast to implement and
> easy solution (and I'm not an OpenGL coder). We will have to decide
> which one to use to get text into NVIZ scene (FTGL?).

Text rendering in OpenGL normally uses glCallLists() and glListBase(). 
This requires a "font" in the form of a contiguous sequence of display
lists, one for each glyph. The individual glyphs are arbitrary display
lists, i.e. sequences of rendering commands: bitmaps, lines, filled
polygons, textured polygons, whatever. Each glyph needs to update
either the current point (for bitmaps) or the current transformation
matrix (for vector primitives) so that subsequent glyphs are
positioned correctly.

The platform-specific APIs (glx, wgl, agl) provide functions to create
suitable display lists from a system font: glXUseXFont, aglUseFont,
wglUseFontBitmaps.

Creating (bitmap- or texture-based) display lists from a FreeType font
is relatively straightforward, given the existing FreeType code in the
display drivers (lib/driver/text3.c). Stroke fonts would also be
straightforward, and would probably look nicer if arbitrary scaling is
required. Filled vector fonts are significantly more complex due to
the need to tessellate the shape into convex polygons.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list