[osg-users] Vanishing letters in osg::Text

Tim Hartter Tim.hartter at gmx.de
Sat Apr 22 14:51:24 PDT 2017


Hi Robert,

I have been playing around with different settings. Changing the bounding 
box did not solve the problem.

Strangely setting a style with depth 0.1 solves the problem if I connect 
via Remote Desktop. Not assigning any font solves tge problem completely - 
the text is just not pretty anymore.

Can you tell me if you are using any special fallback settings in case no 
font is assigned to osg::text?

Tim




Mit AquaMail Android
http://www.aqua-mail.com gesendet


Am 22. April 2017 7:25:33 nachm. schrieb Robert Osfield 
<robert.osfield at gmail.com>:

> 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
>>
> _______________________________________________
> 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