Georg Wünsch wrote:
> Dear opensg users,
> 
> I am having an opensg 1.8 setup where a scenegraph is being drawn by the gui
> thread and another thread is manipulating the graph in the mean time. As I
> understand opensg architecture, this is one of the applications open sg is
> designed to work with.
> 
> I am encountering the following problem:
> 
> In a special object I am storing refptrs to transform cores in the scene
> graph. I would like to manipulate the matrices of the transform cores
> directly by another thread.
> 
> Now a exeption is occurring whenever I am setting up an osg::Matrix with my
> own values and try to assign them to the stored transform core:

What kind of exception?

> Class myclass
> {
> float x11, ..., x44;
> TransformRefPtr myTransform;
> ...
> 
> 
> __forceinline void manipulateTransform()
> {
>       osg::Matrix newMatrix(x11, ..., x44); <<-- throws an exeption(!!!)
>       beginEditCP(myTransform);
>       myTransform->setMatrix(newMatrix);
>       endEditCP(myTransform);
> };
> };
> 
> For some reason the error seems to occur one or two lines before the
> beginEditCP() call. (Btw We are doing a lot of __forceinline AND in the
> single threaded version it is working very well). What might I be doing
> wrong? 

Is the this-ptr correct when that function is called? Is the object 
being destroyed in an other thread due to a race condition? Such things 
might make reads of x11->x44 produce an access violation failure, etc.

The OSG::Matrix constructor is dumb enough so that shouldn't really be 
an issue. See if it happens by just adding x11 and x44 and storing it in 
x33. :)

Also, make sure the myTransform ptr is correct _and_ that there's an 
OpenSG aspect set and initialized for the current thread (but that 
should be ok, as you're already using threads.)

Cheers,
/Marcus


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to