I'm not sure what you mean by "enable". If OSG mimics OpenGL state in the
way fog is done, exponential and linear fog modes are mutually exclusive.
You can render with one or the other, but not both. I would think that OSG
uses the same paradigm...

-Shayne

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Allen
Saucier
Sent: Friday, April 10, 2009 10:27 AM
To: [email protected]
Subject: [osg-users] FOG: applying both kinds at the same time. How?

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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to