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

Julien Valentin julienvalentin51 at gmail.com
Sat Apr 22 09:12:49 PDT 2017


Hi
I'm not really an osg::Text master but my guess is the osg::Text is not mean to be used with a explicit transparent stateset.
You should try to modify the osgText example in order to diagnoze this and tell me if my guess is right.

Cheers


Tim Hartter 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-
> 
>  ------------------
> Post generated by Mail2Forum


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








More information about the osg-users mailing list