[osg-users] ANN: osgPango (alpha)

Jeremy Moles jeremy at emperorlinux.com
Fri Sep 12 09:34:17 PDT 2008


Hello folks!

I'd like to quickly post a message here about (another! yikes!) NodeKit
I'm working on that ties closely with osgWidget and my original
intentions a year ago when I started working on osgWidget in my free
time. :)

I've created a NodeKit that harnesses the power of the Pango engine
(it's used widely in Linux and works in Windows and Mac, leveraging the
power of Clearfont and ATSUI, respectively) for creating 2D text in
OpenGL. It caches glyphs internally using the osgCairo nodekit (another
one of mine) so that it can quickly create groups of quads to form a
string of UTF-8 text on the fly.

Furthermore, I plan on creating two objects in osgPango:

	osgPango::Label
	osgPango::Input

...that can be optionally built and will inherit from osgWidget::Widget,
so as to be used interchangeably with osgWidget (and adhering to the
existing API so that all that is required is a simple typedef).



--------------------------------------------------------------------

The main purposes of this NodeKit are:

	1. To provide nothing less than superb 2D font support for OSG
applications that need to use lots of text in an orthographic
perspective.

	2. To caches all glyphs internally in OSG textures so that only the
first creation of a glyph requires any significant CPU time; all
subsequent use of the character is simply texturing a quad.

	3. To support all layout options provided by Pango (text justify, etc.)

	4. To ensure that all quads are pixel-aligned, for maximum clarity.

	5. Pad all glyphs iternally with one pixel of blank space so that
scaled text in OpenGL blends properly without unsightly anomalies.

	6. Finally, to provide a clean and simple API for accessing every piece
of information necessary to create complicated objects such as input
widgets and the like.

--------------------------------------------------------------------



Keep in mind that just because osgPango is optimized for 2D display
constraints, this doesn't mean you can't throw an osgPango::Text object
(which is just a Geode) into a normal perspective projection (a-la
nameplates above character's names, etc.)

I'm mainly posting this to solicit feedback and generate interest from
others who need high-quality font support in OSG. This isn't intended as
a replacement for osgText, but perhaps will demonstrate what is
"possible" to one day do with osgText.

http://osgpango.googlecode.com

I've got some screenshots there on the Googlecode site, so don't be
shy. :) I'm particularly proud of the outline support, which you'll see
is very high-quality. It's currently implemented as TexEnvCombine
(thanks Cedric!), but I will have a GLSL implementation soon. Check out
the justify screenshot, too...




More information about the osg-users mailing list