[osg-users] Possible to make pixel-pretty text in OSG?

98 views
Skip to first unread message

Jesper D. Thomsen

unread,
Mar 12, 2013, 10:32:18 AM3/12/13
to OpenSceneGraph Users (osg-users@lists.openscenegraph.org)

Hi guys,

 

We’re using OSG in our application to display a modelview and also as the basis for our chart views, which in general is working great for us.
One area where we would want to improve our quality is in the display of text in our charts, where we’re using OSGtext for axis labels etc. (see attached screenshot).

Is there any way in OSG to make this text look nicer in order to be able to use smaller text and still have it readable? Right now, the text quality suffers badly from (I’m guessing) the way the text is rendered to bitmaps and then rescaled when being displayed. I have included a tooltip containing pixel-based text in the screenshot as a comparison

 

Would using OSGPango for text help with this, or would I somehow be able to use OpenGL text directly instead?

The text in question is always being display billboarded and with a fixed pixel height.

 

Thanks

 

Jesper D. Thomsen

AnyBody Technology

TextQualityExample.png

Wang Rui

unread,
Mar 12, 2013, 10:51:47 AM3/12/13
to OpenSceneGraph Users
Hi Jesper,

I've already integrated OSG and AGG (Anti-grained geometry library) to make use of the latter's 2D drawing ability. AGG can draw nice antialiased shapes and texts with very high quality AFAIK, so maybe you would like to have a look at it and see if it could benefit your work.

You may download the osgagg example at:

Wang Rui




2013/3/12 Jesper D. Thomsen <j...@anybodytech.com>
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Thomas Hogarth

unread,
Mar 12, 2013, 5:52:10 PM3/12/13
to osg-...@lists.openscenegraph.org
A quick thing to test is setting the resolution of the font texture being used

osgText::Text setFontResolution

Like you where thinking, at the moment your font is being generated as a texture at a certain resolution, you are then scaling it when rendering causing mipmapping, multi sampling etc to effect it.

So make it the resolution you would expect to see on screen, and if you have it bang on you can also disable mipmapping on the font

font->setMinFilterHint(osg::Texture::NEAREST);
font->setMagFilterHint(osg::Texture::NEAREST);

Be aware though you will need a font texture per resolution you set so can become quite memory hungry.

Wangs suggestion will probably give beter looking results, but the above is pretty easy to test.

Tom

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53068#53068

Sergey Kurdakov

unread,
Mar 12, 2013, 6:35:50 PM3/12/13
to OpenSceneGraph Users
Hi

>Would using OSGPango for text help with this,

Yes, I would recommend to use http://code.google.com/p/osgpango/ ( based on http://code.google.com/p/osgcairo/ )
by Jeremy Moles, at least it gives best results I seen and it is not difficult to use ( there examples there ).

Regards
Sergey



Reply all
Reply to author
Forward
0 new messages