[osg-users] Text Outline pixelated on close up

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Tue May 19 06:14:58 PDT 2020

Hi Rodrigo,

>From the looks of it you are using the osgText's default font that really
is just there as a fallback, it's not intended for normal application
usage.  The OSG has support for using true type fronts, this support is
provided by the freetype plugin, make sure this is being built (requires
the freetype library to be installed) and assign a font to the Text.  See
the osgtext example so see how different fonts are set.


On Tue, 19 May 2020 at 08:53, OpenSceneGraph Users <
osg-users at lists.openscenegraph.org> wrote:

> Hi,
> I'm creating text objects that lie over the map, indicating the name of
> some cities. Pure white text was hard to read (the background represents
> vegetation, so it's colored, but some parts are white). Adding an outline
> solved that, but on close up, the outline looks pixelated and ugly. Using a
> drop_shadow also looks fine from a distance, but strange from a small
> distance, since the black shadow doesn't touch the white text. Is there
> something I can do to improve the appearance of the outline from close up,
> or to reduce the distance between the shadow and the text?
> osg::Node* createLabel(const osg::Vec3& pos, float size, const
> std::string& label, osgText::Text::AxisAlignment axisAlignment)
> {
>     osg::Geode* geode = new osg::Geode();
>     {
>         osgText::Text* text = new osgText::Text;
>         geode->addDrawable( text );
>         text->setPosition(pos);
>         text->setCharacterSize(size);
>         text->setAxisAlignment(axisAlignment);
>         text->setAlignment(osgText::Text::CENTER_CENTER);
>         text->setBackdropType(osgText::Text::OUTLINE); //
>         text->setBackdropColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.5f));
>         std::string dest = desaxUTF8( label );
>         text->setText( dest );
>     }
>     return geode;
> }
> Thanks,
> Rodrigo.
> --
> You received this message because you are subscribed to the Google Groups
> "OpenSceneGraph Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to osg-users+unsubscribe at googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osg-users/82ad1cc1-ec3d-4397-96d3-4bd4dc907c05%40googlegroups.com
> <https://groups.google.com/d/msgid/osg-users/82ad1cc1-ec3d-4397-96d3-4bd4dc907c05%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200519/2aac6669/attachment.html>

More information about the osg-users mailing list