Hi, everyone!!javascript:emoticon(':)')  I'm new to OSG and I am struggling 
with applying both linear and exponential types of fog.

Would someone mind showing me what I'm doing wrong?  Thx for the help! I really 
appreciate it.

  // Fog: Linear
  osg::ref_ptr<osg::Fog> m_ofgFogLinear  = new osg::Fog();
  m_ofgFogLinear->setMode(osg::Fog::LINEAR);
  //m_ofgFogLinear->setDensity(0.001); // makes NO diff for linear
  m_ofgFogLinear->setColor( osg::Vec4d(.75,.75,.75,0.0));
  m_ofgFogLinear->setStart(0.0);
  m_ofgFogLinear->setEnd(5000.0);
  
  osg::ref_ptr<osg::StateSet> stateFogOn=new osg::StateSet();
  stateFogOn->setAttribute(m_ofgFogLinear.get(), osg::StateAttribute::ON);
  stateFogOn->setMode(GL_FOG, osg::StateAttribute::ON);
  stateFogOn->setMode(GL_BLEND, osg::StateAttribute::ON);
  
  //FOG state: exponential
    osg::ref_ptr<osg::Fog> m_ofgFogExponential = new osg::Fog();
  m_ofgFogExponential->setMode(osg::Fog::EXP);
  m_ofgFogExponential->setDensity(0.00005);
  m_ofgFogExponential->setColor( osg::Vec4d(.75,.75,.75,0.0));
  osg::ref_ptr<osg::StateSet> stateFogExpOn=new osg::StateSet();
  stateFogExpOn->setAttribute(m_ofgFogExponential.get(), 
osg::StateAttribute::ON);
  stateFogExpOn->setMode(GL_FOG, osg::StateAttribute::ON);
  
  stateFogOn->setAttribute(m_ofgFogExponential.get(), osg::StateAttribute::ON);
  m_pognRoot->setStateSet(stateFogOn.get());

  Isn't it possible to enable more than 1 attribute w/in a StateSet?  I'm 
trying to enable 2 types of fog w/in the same StateSet and it appears that only 
one is actually in effect - the last one loaded.
... 
Allen

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=10084#10084





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to