From 4065c551efea96e6844eec56d415a73e3e0a509c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 29 Oct 2004 18:24:26 +0000 Subject: [PATCH] Added useage of TexEnvCombine --- examples/osgplanets/osgplanets.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/osgplanets/osgplanets.cpp b/examples/osgplanets/osgplanets.cpp index da3c85271..f86141370 100644 --- a/examples/osgplanets/osgplanets.cpp +++ b/examples/osgplanets/osgplanets.cpp @@ -558,7 +558,26 @@ osg::Geode* SolarSystem::createPlanet( double radius, const std::string& name, c if ( image ) { osg::StateSet* stateset = geodePlanet->getOrCreateStateSet(); - stateset->setTextureAttribute( 1, new osg::TexEnv(osg::TexEnv::ADD)); + + osg::TexEnvCombine* texenv = new osg::TexEnvCombine; + + texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE); + texenv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS); + texenv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR); + texenv->setSource1_RGB(osg::TexEnvCombine::TEXTURE); + texenv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR); + texenv->setSource2_RGB(osg::TexEnvCombine::PRIMARY_COLOR); + texenv->setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR); +/* + texenv->setCombine_Alpha(osg::TexEnvCombine::INTERPOLATE); + texenv->setSource0_Alpha(osg::TexEnvCombine::PREVIOUS); + texenv->setOperand0_Alpha(osg::TexEnvCombine::SRC_ALPHA); + texenv->setSource1_Alpha(osg::TexEnvCombine::TEXTURE); + texenv->setOperand1_Alpha(osg::TexEnvCombine::ONE_MINUS_SRC_ALPHA); + texenv->setSource2_RGB(osg::TexEnvCombine::PRIMARY_COLOR); + texenv->setOperand2_RGB(osg::TexEnvCombine::SRC_ALPHA); +*/ + stateset->setTextureAttribute( 1, texenv ); stateset->setTextureAttributeAndModes( 1, new osg::Texture2D( image ), osg::StateAttribute::ON ); } }