[osg-users] Vanishing letters in osg::Text
Robert Osfield
robert.osfield at gmail.com
Sat Apr 22 10:25:22 PDT 2017
Hi TIm,
It's to know what might be wrong from the description, my best guess
is that it might be some depth buffer resolution issue. Could it be
the filled bounding box that is t fault? Try not enabling this and see
what happens.
Robert.
On 22 April 2017 at 11:18, Tim Hartter <Tim.Hartter at gmx.de> wrote:
> Hello everyone, I have a problem with osg::Text()
> Some letters seem to vanish with depth (see picture) - the "h" in "This is a
> label.." is vanishing if the text is further away from the camera.
>
> Do you have any idea what I'm doing wrong?
>
> This is how I draw the text node: (the font does not matter by the way...)
>
> osg::ref_ptr<osg::StateSet> pStateset(new osg::StateSet());
>
> pStateset->setMode(GL_LIGHTING,
> osg::StateAttribute::OFF |
> osg::StateAttribute::PROTECTED |
> osg::StateAttribute::OVERRIDE);
>
> pStateset->setMode(GL_BLEND, osg::StateAttribute::ON);
> pStateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
> pStateset->setRenderBinDetails(INT_MAX, "RenderBin",
> osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
>
> osg::ref_ptr<osgText::Text> pText( new osgText::Text );
> osg::ref_ptr<osg::Geode> pTextGeode ( new osg::Geode );
> pText->setFont(pFont);
> pText->setText(Text.c_str());
> pText->setAutoRotateToScreen(true);
> pText->setDrawMode(osgText::Text::TEXT |
> osgText::Text::FILLEDBOUNDINGBOX);
> pText->setBoundingBoxMargin(FontSize * 0.1);
> pText->setFontResolution(96, 96);
> pText->setCharacterSize(FontSize);
> pText->setPosition(Position);
> pText->setColor(osg::Vec4d(1,0,0,1));
> pText->setStateSet(pStateset.get());
> pText->setUseDisplayList(false);
>
> pTextGeode->addDrawable(pText);
> pTextGeode->setStateSet(pStateset);
> return pTextGeode;
>
>
> I'd be greatful for any help on the matter.
> -Tim-
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
More information about the osg-users
mailing list