diff --git a/examples/osgfont/osgfont.cpp b/examples/osgfont/osgfont.cpp index 43a8653d5..823e7ae24 100644 --- a/examples/osgfont/osgfont.cpp +++ b/examples/osgfont/osgfont.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -200,6 +201,29 @@ int main(int argc, char** argv) root = transform; } + osg::ref_ptr program = new osg::Program; + std::string shaderFilename; + while(args.read("--shader", shaderFilename)) + { + osg::ref_ptr shader = osgDB::readRefShaderFile(shaderFilename); + if (shader.get()) + { + OSG_NOTICE<<"Loading shader "<addShader(shader.get()); + } + } + + if (program->getNumShaders()>0) + { + OSG_NOTICE<<"Using shaders"<getOrCreateStateSet()->setAttribute(program.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON); + root->getOrCreateStateSet()->addUniform(new osg::Uniform("glyphTexture", 0)); + } + + + std::string outputFilename; + if (args.read("-o", outputFilename)) {} + if (args.argc() > 1) { settings.fontFilename = argv[1]; @@ -235,10 +259,9 @@ int main(int argc, char** argv) root->addChild(geode); - std::string filename; - if (args.read("-o", filename)) + if (!outputFilename.empty()) { - osgDB::writeNodeFile(*root, filename); + osgDB::writeNodeFile(*root, outputFilename); return 0; }