[osg-users] Updating VBO's during runtime

Brad Colbert bcolbert at rscusa.com
Fri Jun 1 08:26:23 PDT 2018


Hah!  Daniel, that was it.  Darnit!

BTW, I used to work at Code 5580.  WAY back in the day.

Thanks!

Robert, sorry, I meant to mention version 3.6.0.

Cheers,
Brad

On Fri, Jun 1, 2018 at 7:39 AM, Daniel Emminizer, Code 5773 <
dan.emminizer at nrl.navy.mil> wrote:

> Hi Brad,
>
>
>
> Check to make sure your Geometry has setDataVariance(osg::Object::DYNAMIC).
> That solved the problem for most of our similar cases.
>
>
>
> - Dan
>
>
>
>
>
> *From:* osg-users [mailto:osg-users-bounces at lists.openscenegraph.org] *On
> Behalf Of *Brad Colbert
> *Sent:* Friday, June 01, 2018 10:20 AM
> *To:* osg-users at lists.openscenegraph.org
> *Subject:* [osg-users] Updating VBO's during runtime
>
>
>
> I'm updating my vertices at runtime.  I've found a few posts that discuss
> this:
>
>
>
> (a couple are:)
>
> http://forum.openscenegraph.org/viewtopic.php?t=14826
>
> http://forum.openscenegraph.org/viewtopic.php?t=15782
>
>
>
> Let me first mention that I've compiled OSG with GL3 support, so no
> display lists.  That said, I'm still calling:
>
>
>
>   pointsGeom->setUseDisplayList(false);
>
>   pointsGeom->setUseVertexBufferObjects(true);
>
>
>
> Here is a snippet of my call to update the vertices (v_ = vertices, c_ =
> colors, n_ = normals, da_ = DrawArrays, g_ = Geometry):
>
>
>
>     for (int i = 0; i < numVertices; i++) {
>
>       // Verticies
>
>       v_.at(i)[0] = 500.f * (0.0f + (3.0f * float(rand() % 1000) / 1000.f)
> - 1.5f);
>
>       v_.at(i)[1] = 500.f * (0.0f + (4.0f * float(rand() % 1000) / 1000.f)
> - 2.f);
>
>       v_.at(i)[2] = 500.f * (1.5f + (0.1f * float(rand() % 1000) / 1000.f)
> - 0.05f);
>
>
>
>       // Colors
>
>       c_.at(i)[0] = 1.f;
>
>       c_.at(i)[1] = 1.f;
>
>       c_.at(i)[2] = 1.f;
>
>       c_.at(i)[3] = 1.f;
>
>
>
>       // Normals
>
>       n_.at(i)[0] = 0.f;
>
>       n_.at(i)[1] = 1.f;
>
>       n_.at(i)[2] = 0.f;
>
>     }
>
>
>
>     v_.dirty();
>
>     c_.dirty();
>
>     n_.dirty();
>
>
>
>     da_.setCount(numVertices);
>
>     da_.dirty();
>
>
>
> *    // *** The dirty() calls above are supposed to tell OSG to update the
> VBO's.  For*
>
> *    // some reason this isn't happening.  We are going to force it here.
> Not sure of the*
>
> *    // performance implications but hopefully this is temporary.*
>
> *    g_.setVertexArray(&v_);*
>
> *    g_.setColorArray(&c_);*
>
> *    g_.setNormalArray(&n_);*
>
>
>
>     g_.dirtyBound();
>
>
>
> The update just doesn't happen unless I call the *setVertexArray*,
> *setColorArray*, *setNormalArray* methods which doesn't match what the
> previous posts about this topic.
>
>
>
> Is this because of GL3 or something else?
>
>
>
> Thanks,
>
> Brad
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180601/a34e40ea/attachment.html>


More information about the osg-users mailing list