[osg-users] stateset, culling

2009-04-16 Thread petr srom
Hi,

I need to render back face of .ive models, in open GL is the syntax:
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);   

Is the syntax in OSG these way? 
osg::StateSet *myst = new osg::StateSet();
myst-setMode(GL_CULL_FACE, osg::StateAttribute::ON); 
myst-setMode(GL_FRONT, osg::StateAttribute::ON); 
root-setStateSet(myst);

Why it doesn't work? I can see still front face. Where is my mystake?

Thank you.

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





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


Re: [osg-users] stateset, culling

2009-04-16 Thread Ulrich Hertlein

On 16/4/09 8:47 AM, petr srom wrote:

I need to render back face of .ive models, in open GL is the syntax:
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);

Is the syntax in OSG these way?
osg::StateSet *myst = new osg::StateSet();
myst-setMode(GL_CULL_FACE, osg::StateAttribute::ON);
myst-setMode(GL_FRONT, osg::StateAttribute::ON);
root-setStateSet(myst);


You're setting them wrong.  Use osg::CullFace instead:

osg::CullFace* cf = new osg::CullFace(osg::CullFace::FRONT);
myst-setAttributeAndModes(cf, osg::StateAttribute::ON);

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


Re: [osg-users] stateset, culling

2009-04-16 Thread petr srom
thanks, but it still doesn't work  : / 

myst was renamed by stateset

void Environment::set_fog(osg::Group* root)
{
fog-setMode(osg::Fog::LINEAR);
fog-setDensity(0.1f); 
fog-setColor(osg::Vec4f(0.8f,0.8f,0.8f,1.0f)); 
fog-setStart(-20.0f);
fog-setEnd(90.0f); 
stateset-setAttribute(fog, osg::StateAttribute::ON); 
stateset-setMode(GL_FOG, osg::StateAttribute::ON | 
osg::StateAttribute::OVERRIDE);
//show backface (test)
osg::CullFace* cf = new osg::CullFace(osg::CullFace::FRONT); 
stateset-setAttributeAndModes(cf, osg::StateAttribute::ON);
root-setStateSet(stateset);
}

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





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