From ef93f9632878cbfe78a181d4f1713f2c3921cef2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 7 Jul 2004 15:05:00 +0000 Subject: [PATCH] Added lighting and materials to volume subgraph --- examples/osgvolume/osgvolume.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/osgvolume/osgvolume.cpp b/examples/osgvolume/osgvolume.cpp index bd4f96d96..f36be686f 100644 --- a/examples/osgvolume/osgvolume.cpp +++ b/examples/osgvolume/osgvolume.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -533,9 +534,13 @@ osg::Node* createModel(osg::ref_ptr& image_3d, bool createNormalMap) osg::StateSet* stateset = texgenNode_0->getOrCreateStateSet(); - stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF); + stateset->setMode(GL_LIGHTING,osg::StateAttribute::ON); stateset->setMode(GL_BLEND,osg::StateAttribute::ON); - stateset->setAttribute(new osg::AlphaFunc(osg::AlphaFunc::GREATER,0.02f),osg::StateAttribute::OVERRIDE); + stateset->setAttribute(new osg::AlphaFunc(osg::AlphaFunc::GREATER,0.02f)); + + osg::Material* material = new osg::Material; + material->setDiffuse(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0f,1.0f,1.0f,1.0f)); + stateset->setAttributeAndModes(material); if (!createNormalMap) {