hi users,
i have tried to create a simple example using fog. As I understand it the
start and end values define where the fog starts and ends relative to the
camera?
but....
not matter what values I use it doesn't effect my rendering. I seem to
always get the same fog rendering.
can someone explain/clarifiy what I'm not understanding?
Here is the code if you need to test:
#include <osg/ShapeDrawable>
#include <osg/fog>
osg::Node* CreateScene()
{
osg::Geode* pGeode = new osg::Geode();
for ( int x=0; x<10; x++ )
{
for ( int y=0; y<10; y++ )
{
pGeode->addDrawable( new osg::ShapeDrawable( new
osg::Sphere(osg::Vec3(x,y,0.0f),0.3f) ) );
}
}
osg::Fog* pFog = new osg::Fog();
pFog->setMode( osg::Fog::EXP2 );
pFog->setColor( osg::Vec4( 1, 1, 1, 1) );
pFog->setStart( 5 );
pFog->setEnd( 20 );
pFog->setDensity( 0.08f );
pGeode->getOrCreateStateSet()->setAttribute( pFog, osg::StateAttribute::ON
);
pGeode->getOrCreateStateSet()->setMode( GL_FOG, osg::StateAttribute::ON );
return pGeode;
}
regards,
Peter Wraae Marino
http://osghelp.com
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org