From 6df273a865d752ab1756d92a38ced03e99aeb5ca Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 24 Apr 2017 09:44:59 -0400 Subject: [PATCH] Turned off lighting in examples/osggeometry This way you can see the image and the points even if you view them close to edge-on. --- examples/osggeometry/osggeometry.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/osggeometry/osggeometry.cpp b/examples/osggeometry/osggeometry.cpp index 27b4eec1f..0459ce6b1 100644 --- a/examples/osggeometry/osggeometry.cpp +++ b/examples/osggeometry/osggeometry.cpp @@ -510,8 +510,10 @@ osg::Node* createScene() geode->addDrawable(polyGeom); } + geode->getOrCreateStateSet()->setMode(GL_LIGHTING, + osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED); return geode; -} +} //createScene() // define a node callback to animate a transform as a cycle along the y axis, between 0 and 2.0. @@ -543,9 +545,10 @@ class MyTransformCallback : public osg::NodeCallback float _angular_velocity; -}; - +}; //class MyTransformCallback +/// Create a quad that sits behind the geometry from createScene() +/// and shows the image from the OpenGL docs that geometry duplicates. osg::Node* createBackground() { @@ -625,22 +628,22 @@ osg::Node* createBackground() polyGeom->setStateSet(stateset); - // create the Geode (Geometry Node) to contain all our osg::Geometry objects. + // create the Geode (Geometry Node) to contain the quad's osg::Geometry osg::Geode* geode = new osg::Geode(); // add the points geometry to the geode. geode->addDrawable(polyGeom); - //return geode; + geode->getOrCreateStateSet()->setMode(GL_LIGHTING, + osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED); // create a transform to move the background back and forward with. - osg::MatrixTransform* transform = new osg::MatrixTransform(); transform->setUpdateCallback(new MyTransformCallback(1.0f)); transform->addChild(geode); return transform; -} +} //createBackground() int main(int, char **) {