Re: [osg-users] Updating tesselator

2010-01-01 Thread Martin Beckett
Yes, I am clearing the display lists (sorry I cut it out with a bunch of other 
irrelevent code)

It's odd that it draws a filled polygon upto 4 points but then no further - it 
doesn't matter if the extra points would make it convex or simple, or if I go 
cw or ccw.

I know the tesselator works for more complex shapes since I use it elsewhere in 
the app.

Martin

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





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


Re: [osg-users] Updating tesselator

2010-01-01 Thread Simon Hammett
2009/12/31 Martin Beckett 

> I am trying to draw a rubber band wioth the mouse around a selection
> I get the mouse position, convert into world coords (assumign a plan view)
> then add the new point to the geometry.
> I then call osg::Util Tessellator to build the selection into a polygon.
>
> This works, but only for the first 4 points! After that I can continue to
> draw a line but not a filled polygon?
>
>
You probably need to clear the display list, try

 _geometry->dirtyDisplayList();

If that works and you are updating it every frame, you may as well turn
display lists off.

 _geometry->setUseDisplayList(false);

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


[osg-users] Updating tesselator

2009-12-31 Thread Martin Beckett
I am trying to draw a rubber band wioth the mouse around a selection
I get the mouse position, convert into world coords (assumign a plan view) then 
add the new point to the geometry.
I then call osg::Util Tessellator to build the selection into a polygon.

This works, but only for the first 4 points! After that I can continue to draw 
a line but not a filled polygon?



Code:

createPolygon() {
_geode = new osg::Geode;
_geometry=new osg::Geometry;
_geometry->setVertexArray(_vertices);

// set colour ...
// set normal ...

_vertices->push_back(point);
_geometry->addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,1));
_geometry->addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,1));
_geode->addDrawable(_geometry);

_root->addChild(_geode);
}

updatePolygon(){
// update point counts  

((osg::DrawArrays*)_geometry->getPrimitiveSet(0))->setCount(_vertices->size());

((osg::DrawArrays*)_geometry->getPrimitiveSet(1))->setCount(_vertices->size());

// update polygon - assuming >2 points!
osgUtil::Tessellator* tessellator = new osgUtil::Tessellator;   
tessellator->setBoundaryOnly(true);
tessellator->setTessellationType(osgUtil::Tessellator::TESS_TYPE_POLYGONS); 

tessellator->setWindingType( osgUtil::Tessellator::TESS_WINDING_POSITIVE); 
// don't know
tessellator->setTessellationNormal(osg::Z_AXIS);
tessellator->retessellatePolygons(*_geometry);  

}






Martin

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





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