[osg-users] modifying vertexs

Brian R Hill bhill22 at csc.com
Fri Mar 6 04:35:21 PST 2009


You are addressing three different things in your email, display lists,
geometry changes, primitive count.

Dirtying the display list simply regenerates the display list and if you've
changed the verts, they will get compiled into the new display list. If
they weren't changed, then they'd still get recompiled into the new list.

Changing the vertex array tells the underlying objects that their geometry
has changed. If you look at the setVertexArray method you'll see it calls
dirtyDisplayList and dirtyBound.

Changing the primitset set count only changes how many primitives are drawn
it doesn't change the contents of the vertex array - only which ones are
being used. It doesn't call dirtyDisplayList or dirtyBound.

You need to understand these differences to optimally use them for the
specific situation.

If your geometry changes frequently (every frame), then just disable
display lists. You're wasting time regenerating the display lists.

If the geometry changes don't really affect the bounding volume, then don't
call setVertexArray. Again, you're wasting your time regenerating the
bounding volume. Or, overload the computeBound method and calculate the
bounding volume based on your knowledge of how you changed the geometry.

I use setCount all the time for particle systems whose particles have
varying lifetimes. I've found this use in particular to benefit from
disabling display lists and using my own computeBound method.


This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose. •

-----osg-users-bounces at lists.openscenegraph.org wrote: -----

To: osg-users at lists.openscenegraph.org
From: Jim Brooks <jimblist at gmail.com>
Sent by: osg-users-bounces at lists.openscenegraph.org
Date: 03/05/2009 09:56PM
Subject: [osg-users] modifying vertexs

Found two different ways to tell OSG that vertexs were modified.
Maybe these are circumventions that aren't proper (?).

What is the "one right way"?
Call dirtyDisplayList() ?

:    mVertexs(new osg::Vec3Array),
    mDrawArray(new osg::DrawArrays( osg::PrimitiveSet::POINTS,0,0))

void AddParticle( const osg::Vec3& v )
    mVertexs->push_back( v );

   mDrawArray->setCount( mVertexs->size() );

// Passing same vertex array causes update.
    mGeom->setVertexArray( mVertexs.get() );

osg-users mailing list
osg-users at lists.openscenegraph.org

More information about the osg-users mailing list