Added assignStateSet() to Text::setBackgroundColor()

This commit is contained in:
Robert Osfield 2017-09-21 16:01:27 +01:00
parent 12904105f8
commit 4b6722ab44
2 changed files with 11 additions and 3 deletions

View File

@ -193,9 +193,7 @@ osg:: Node* createTextLeft(const osg::BoundingBox& bb, const std::string& label,
//text->setColor(osg::Vec4(0.37f,0.48f,0.67f,1.0f)); // Neil's original OSG colour //text->setColor(osg::Vec4(0.37f,0.48f,0.67f,1.0f)); // Neil's original OSG colour
text->setColor(osg::Vec4(0.20f,0.45f,0.60f,1.0f)); // OGL logo colour text->setColor(osg::Vec4(0.20f,0.45f,0.60f,1.0f)); // OGL logo colour
text->setBackdropType(osgText::Text::OUTLINE); OSG_NOTICE<<std::endl<<"***** POS A ******"<<std::endl;
text->setBackdropOffset(0.03f);
text->setBackdropColor(osg::Vec4(0.0f, 0.0f, 0.5f, 1.0f));
if (s_useSDF) if (s_useSDF)
{ {
@ -203,6 +201,14 @@ osg:: Node* createTextLeft(const osg::BoundingBox& bb, const std::string& label,
text->setBackdropImplementation(osgText::Text::USE_SHADERS); text->setBackdropImplementation(osgText::Text::USE_SHADERS);
} }
OSG_NOTICE<<std::endl<<"***** POS B ******"<<std::endl;
text->setBackdropType(osgText::Text::OUTLINE);
text->setBackdropOffset(0.03f);
text->setBackdropColor(osg::Vec4(0.0f, 0.0f, 0.5f, 1.0f));
OSG_NOTICE<<std::endl<<"***** POS C ******"<<std::endl;
text->setColorGradientMode(osgText::Text::OVERALL); text->setColorGradientMode(osgText::Text::OVERALL);
osg::Vec4 lightblue(0.30f,0.6f,0.90f,1.0f); osg::Vec4 lightblue(0.30f,0.6f,0.90f,1.0f);
osg::Vec4 blue(0.10f,0.30f,0.40f,1.0f); osg::Vec4 blue(0.10f,0.30f,0.40f,1.0f);

View File

@ -1507,6 +1507,8 @@ void Text::setBackdropOffset(float horizontal, float vertical)
void Text::setBackdropColor(const osg::Vec4& color) void Text::setBackdropColor(const osg::Vec4& color)
{ {
_backdropColor = color; _backdropColor = color;
assignStateSet();
} }
void Text::setColorGradientMode(ColorGradientMode mode) void Text::setColorGradientMode(ColorGradientMode mode)