Hi Renan,

Quoting Renan Mendes <[EMAIL PROTECTED]>:
> Well. I've got a question here. I've addapted that code you've given me so
> that it was supposed to create a sphere. You can deduce that it didn't (it
> just draws the original circle). I was wondering if you could point out my
>...
> osg::Vec3Array*
> circleVerts( int plane, int approx, float radius )
> {
>...
>     for(count = 0; count <= approx/4; count++)
>     {
>...
>     for( idx=0; idx<approx; idx++)
>     {
>...
>         v->push_back( osg::Vec3( x, y, z ) );
>     }
>     }
> }
>...
> osg::Geode*
> circles( int plane, int approx, float radius )
> {
>     osg::Geometry* geom = new osg::Geometry;
>     osg::Vec3Array* v = circleVerts( plane, approx, radius );
>...
>     geom->addPrimitiveSet( new osg::DrawArrays( GL_LINE_LOOP, 0, approx ) );

As far as I can see you're creating 'approx/4' circles each with 'approx'
vertices. This means that the vertex array contains '(approx/4)+1 * approx'
vertices but the 'DrawArrays' only displays the first 'approx' vertices.

If you change that last line to:

geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_LOOP, 0,
approx*(approx/4)+1));

you should start to see more what you expect.

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

Reply via email to