diff --git a/include/osgText/Text b/include/osgText/Text index acb8323f9..ab5e547a0 100644 --- a/include/osgText/Text +++ b/include/osgText/Text @@ -36,6 +36,13 @@ public: virtual const char* className() const { return "Text"; } virtual const char* libraryName() const { return "osgText"; } + /** Set the ShaderTechnique hint to specify what fatures in the text shaders to enable.*/ + void setShaderTechnique(ShaderTechnique technique); + + /** Get the ShaderTechnique hint.*/ + ShaderTechnique getShaderTechnique() { return _shaderTechnique; } + + /** * Turns off writing to the depth buffer when rendering text. This only affects text * with no backdrop or text using the DELAYED_DEPTH_WRITES implementation, since @@ -282,6 +289,7 @@ protected: void drawImplementationSinglePass(osg::State& state, const osg::Vec4& colorMultiplier) const; + ShaderTechnique _shaderTechnique; bool _enableDepthWrites; BackdropType _backdropType; diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index 82c77d548..f2ef6ecbb 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -25,10 +25,15 @@ #include +#include +#include + + using namespace osg; using namespace osgText; Text::Text(): + _shaderTechnique(GREYSCALE), _enableDepthWrites(true), _backdropType(NONE), _backdropHorizontalOffset(0.07f), @@ -47,6 +52,7 @@ Text::Text(): Text::Text(const Text& text,const osg::CopyOp& copyop): osgText::TextBase(text,copyop), + _shaderTechnique(text._shaderTechnique), _enableDepthWrites(text._enableDepthWrites), _backdropType(text._backdropType), _backdropHorizontalOffset(text._backdropHorizontalOffset), @@ -65,8 +71,15 @@ Text::~Text() { } -#include -#include + +void Text::setShaderTechnique(ShaderTechnique technique) +{ + if (_shaderTechnique==technique) return; + + _shaderTechnique = technique; + + assignStateSet(); +} osg::StateSet* Text::createStateSet() {