Improved handling of osgText::Text with and wihout shaders

This commit is contained in:
Robert Osfield
2017-03-17 14:33:56 +00:00
parent e6703e3cb0
commit 943beb220d
2 changed files with 69 additions and 36 deletions

View File

@@ -87,7 +87,8 @@ static const char* fragmentShader = {
"varying vec4 vertexColor;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = vertexColor * texture(glyphTexture, texCoord).aaaa;\n"
" if (texCoord.x>=0.0) gl_FragColor = vertexColor * vec4(1.0, 1.0, 1.0, texture(glyphTexture, texCoord).a);\n"
" else gl_FragColor = vertexColor;\n"
"}\n"
};
@@ -710,12 +711,11 @@ struct TextCounterCallback : public osg::NodeCallback
TextCounterCallback():
_textCounter(100000) {}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
virtual void operator()(osg::Node* node, osg::NodeVisitor*)
{
osgText::Text* text = dynamic_cast<osgText::Text*>(node);
if (text)
{
std::stringstream str;
str <<"Text Counter "<<_textCounter<<std::endl;
OSG_NOTICE<<"Udating text"<<str.str()<<std::endl;