Hi,

First of all, thank you for your answer. I took a look at osgscribe and I tried 
to do the same thing, but it doesn't really work. I tried many things but this 
is my last attempt:


Code:
geode = new osg::Geode;
geometry = new osg::Geometry;

osg::ref_ptr<osg::Vec3Array> v = new osg::Vec3Array;
geometry->setVertexArray(v.get());
v->push_back(vertex1->getPosition());
v->push_back(vertex2->getPosition());
        
setColor(SEGMENT_COLOR);
geometry->addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::LINES,0,v->size()));

geode->addDrawable(geometry.get());
addChild(geode.get());

//osg::StateSet* ss = getOrCreateStateSet();
osg::StateSet* stateset = new osg::StateSet;
osg::PolygonOffset* polyoffset = new osg::PolygonOffset;
polyoffset->setFactor(-1.0f);
polyoffset->setUnits(-1.0f);
osg::PolygonMode* polymode = new osg::PolygonMode;
polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE);
stateset->setAttributeAndModes(polyoffset,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);

osg::ref_ptr<osg::LineWidth> line = new osg::LineWidth;
line->setWidth(SEGMENT_SIZE);
stateset->setAttribute(line.get()); 
stateset->setMode( GL_LIGHTING, osg::StateAttribute::OFF );

setStateSet(stateset);



This is part of my class Line that inherits from Group. But despite all that, I 
still have the same problem, some lines are still hidden by surfaces, and I'm 
unable to select some other lines.
What am I doing wrong ?


I also have another question for the manipulator. I want to enable the user to 
switch from a perspective view to an orthographic view. Everything works fine, 
but at some point, I need to force the computation of the new clipping planes. 
I can't wait for the auto computation and I'm not sure of how to do that.

After some researches I found out that the cull visitor would be perfect for 
that, but how can I attach a cull visitor to the camera ? I read in the FAQ 
that the Camera was a subclass of cullVisiotr, but it doesn't seem to wright. 
Does anyone have a clue?

Thanks again,
bob.

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





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

Reply via email to