[osg-users] Osg Text issues
Dan johansson
johansson_dan at hotmail.com
Tue Nov 19 01:50:47 PST 2019
Hi,
I am creating a simple coordinate system and trying to use the osg text for axis labelling and tick information. This is the settings i use for creating the text
Code:
OsgText2D::OsgText2D() :
textGeode_(new osg::Geode),
osgText_(new osgText::Text)
{
osgText_->setFont("media/fonts/Roboto-Light.ttf");
osgText_->setText("Sphere");
textNode_ = new osg::PositionAttitudeTransform;
textGeode_->setDataVariance(osg::Object::DYNAMIC);
osgText_->setDataVariance(osg::Object::DYNAMIC);
textNode_->addChild(textGeode_);
textNode_->setPosition(osg::Vec3f(0.f,0.f,0.f));
textType_ = GI::TextType::TEXT_3D;
osgText_->setFontResolution(40, 40);
osgText_->setEnableDepthWrites(false);
osgText_->setDrawMode(osgText::Text::TEXT);
textGeode_->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
osg::DisplaySettings::instance()->setTextShaderTechnique("NO_TEXT_SHADER");
osgText_->setCharacterSize(30);
osgText_->setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
osgText_->setAutoRotateToScreen(true);
osgText_->setText("xyz");
textGeode_->getStateSet()->setRenderBinToInherit();
osgText_->setColor(osg::Vec4(0.f,0.f,0.f,1.f));
//osgText_->setBackdropType(osgText::Text::OUTLINE);
//osgText_->setBackdropColor(osg::Vec4(0.0, 0.0, 0.0, 0.0));
osgText_->setBoundingBoxColor(osg::Vec4(0.0,0.0,0.0,0.0));
textGeode_->addDrawable(osgText_);
}
And this is the output i recieve
https://imgur.com/a/MgeXSB4
As you can see the quality is very poor. I've been trying all settings i can find and the only solution i've found is to to activate the backdrop with outline in black, but its very ugly to have a black outline on the text so i would like to solve it better. Any tips on how to improve this?
Thanks in advance
Best regards Dan
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76914#76914
More information about the osg-users
mailing list