You don't need to generate new vertex arrays each frame, and you don't need
the mutex either, at least not for OSG. Disable display lists, enable VBOs,
set the data variance of the vertex arrays to Object::DYNAMIC. During each
frame update the existing arrays and call their dirty() method.

Tim

On Wed, Nov 24, 2010 at 10:26 AM, Werner Modenbach <
[email protected]> wrote:

>  Dear all,
>
> I'm using osg in an application running on Linux and Windows using Qt and
> adapter widget.
>
> I'm showing the relaxation process in a textile fabric and the number of
> vertices can reach huge numbers. The scene (Geodes representing one yarn
> thread each) has to be updated after each relaxation step.
>
> The geodes are children of a switch node.
>
> My first approach was creating all the new geodes in a first step and
> replacing the old ones in a loop ofer the nodes by calling setChild(index,
> newGeode). This worked fine on small scenes but failed on big scenes on 32
> bit machines because of the amount of data.
>
> My second approach is getting pointers to the geodes, replacing their
> arrays (vertices etc.) by newly created ones and filling them with new data.
> This way crashes my application on some systems.
>
> Both methods block updates by setting a mutex, create the new data in
> threads and unlock the mutex after that.
>
> Painting is done like that:
>
>  virtual void paintGL() {
>
> if (!mutex.tryLock()) return;
>
> frame();
>
> mutex.unlock();
>
> }
>
> I'm sorry for the lengthy explanation. I have several questions regarding
> the crashes:
>
> - Is there any other activity in the data structures outside paintGL() ?
>
> - Do I have to do anything to avoid access to cashed structures which might
> be obsolete?
>
> Thanks for any hint
>
> - Werner -
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to