Hi,

I'm currently experimenting with a 2D Canvas and rendering everything to
a texture. For this I use FGODGauge to render to texture and
FGODGauge::set_texture to replace a texture in the cockpit with the
texture from the fbo. This works very well unless I enable any effect
which causes the texture to be replaced by the original one.

I have just extended the ReplaceStaticTextureVisitor::apply(osg::Geode&
node) method to also replace texture inside effects:

virtual void apply(osg::Geode& node)
    {
      simgear::EffectGeode* eg =
        dynamic_cast<simgear::EffectGeode*>(&node);
      if( eg )
      {
        osg::StateSet* ss = eg->getEffect()->getDefaultStateSet();
        if( ss )
          changeStateSetTexture(ss);
      }
      else
        if( node.getStateSet() )
          changeStateSetTexture(node.getStateSet());
      int numDrawables = node.getNumDrawables();
      for (int i = 0; i < numDrawables; i++) {
          osg::Drawable* drawable = node.getDrawable(i);
          osg::StateSet* ss = drawable->getStateSet();
          if (ss)
              changeStateSetTexture(ss);
      }
      traverse(node);
    }

Does anyone know how I can correctly replace a texture, such that it
also stays there if effects are enabled (eg. generic effect).

Thanks,
Tom

-- 
Thomas Geymayer  www.tomprogs.at / C-Forum und Tutorial: www.proggen.org
------------------------------------------------------------------------
        Student of Software Engineering & Business Administration
-------------------- Graz University of Technology ---------------------

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to