- _coverage_samples = coverage_samples;
- _color_samples = color_samples;
-
- updateSampling();
-}
-
-//------------------------------------------------------------------------------
-void ODGauge::setRender(bool render)
-{
- // Only the far camera should trigger this texture to be rendered.
- camera->setNodeMask(render ? simgear::BACKGROUND_BIT : 0);
-}
-
-//------------------------------------------------------------------------------
-bool ODGauge::serviceable(void)
-{
- return rtAvailable;
-}
-
-//------------------------------------------------------------------------------
-void ODGauge::allocRT(osg::NodeCallback* camera_cull_callback)
-{
- camera = new osg::Camera;
- camera->setDataVariance(osg::Object::DYNAMIC);
- camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
- camera->setRenderOrder(osg::Camera::PRE_RENDER);
- camera->setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f , 0.0f));
- camera->setClearStencil(0);
- camera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT,
- osg::Camera::FRAME_BUFFER );
-
- if( camera_cull_callback )
- camera->setCullCallback(camera_cull_callback);
-
- setRender(true);
- updateCoordinateFrame();
- updateStencil();
-
- osg::StateSet* stateSet = camera->getOrCreateStateSet();
- stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
- stateSet->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
- stateSet->setMode(GL_FOG, osg::StateAttribute::OFF);
- stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
- stateSet->setAttributeAndModes(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK,
- osg::PolygonMode::FILL),
- osg::StateAttribute::ON);
- stateSet->setAttributeAndModes(new osg::AlphaFunc(osg::AlphaFunc::GREATER,
- 0.0f),
- osg::StateAttribute::ON);
- stateSet->setAttribute(new osg::ShadeModel(osg::ShadeModel::FLAT));
- stateSet->setAttributeAndModes(new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA,
- osg::BlendFunc::ONE_MINUS_SRC_ALPHA),
- osg::StateAttribute::ON);
- if( !texture )