[osg-users] Direct VertexArray Modification

Robert Osfield robert.osfield at gmail.com
Wed Sep 5 04:32:35 PDT 2007


Hi Nick,

The OSG by default uses display lists, which are built on the first
time the geometry is rendered.  If you are dynamically updating
geometry then you need to either call geometry->dirtyDisplayLists() or
switch them off via geometry->setUseDisplayLists(false);

You will probably also need to call geometry->dirtyBound() to ensure
culling works fine.

On 9/5/07, Nick Prudent <valerianmusic at hotmail.com> wrote:
>
> Inside my render loop, I'm updating some geometry based on external events. When I change a transform (rotation + translate),  everything updates fines. However, if I change vertices directly, nothing happend. Is there a flag that I need to reset to force the system to recompute the render graph?
>
> Here's the code I use:
>
>    // Get vertex array
>     osg::Vec3Array* pVertices = (osg::Vec3Array*)pGeometry->getVertexArray();
>     if ( !pVertices )
>         return;
>     // Change vertices
>     (*pVertices)[0].set( xMin,          yMax, depth );
>     (*pVertices)[1].set( xMin,          yMin, depth );
>     (*pVertices)[2].set( xMax_new, yMin, depth );
>     (*pVertices)[3].set( xMax_new, yMax, depth );
>
>
> In fact, this only works the first time...No idea why...
>
> Thanks,
>
> - Nick -
> _________________________________________________________________
> Connect to the next generation of MSN Messenger
> http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list