From 64e4adf0b95f12f2710d40550372b197423b3874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Garc=C3=ADa=20Li=C3=B1=C3=A1n?= Date: Fri, 14 May 2021 22:47:28 +0200 Subject: [PATCH] Fix osgText issues under OSG 3.6 It looks like assigning an Effect to the geode containing the osgText is enough and there aren't any conflicts with OSG own shaders. This might change in the future if the switch to the core profile happens. The text shaders also rely on fixed pipeline features like gl_FrontColor. This is because aircraft developers are used to using material animations to change the text color. --- simgear/scene/model/SGText.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/simgear/scene/model/SGText.cxx b/simgear/scene/model/SGText.cxx index 21fc0c8f..0f3c705c 100644 --- a/simgear/scene/model/SGText.cxx +++ b/simgear/scene/model/SGText.cxx @@ -27,6 +27,9 @@ #include #include #include +#include +#include +#include #include #include @@ -92,9 +95,16 @@ osg::Node * SGText::appendText(const SGPropertyNode* configNode, SGConstPropertyNode_ptr p; osgText::Text * text = new osgText::Text(); - osg::Geode * g = new osg::Geode; + simgear::EffectGeode * g = new simgear::EffectGeode; g->addDrawable( text ); + SGPropertyNode_ptr effectProp = new SGPropertyNode; + makeChild(effectProp, "inherits-from")->setStringValue("Effects/text-default"); + simgear::Effect* effect = simgear::makeEffect( + effectProp, true, dynamic_cast(options)); + if (effect) + g->setEffect(effect); + SGPath path("Fonts" ); path.append( configNode->getStringValue( "font", "Helvetica" )); text->setFont( path.utf8Str() );