Hi,

I don't think its allowed to call captureCurrentState in Cull stage. I am not certain about this, but would expect that captureCurrentState would read OpenGL state and update osg::State accordingly. If this is the case then it does require valid OpenGL context, which is only guaranteed to be valid in Render stage. SingleThreaded mode is bit different and manages SceneViews differently which has the side effect that OpenGL context often remains valid beetwen Render stages .

Wojtek

--------------------------------------------------
From: "PCJohn" <[email protected]>
Sent: Tuesday, August 03, 2010 4:38 PM
To: "OpenSceneGraph Users" <[email protected]>
Subject: [osg-users] threading and captureCurrentState

Hi,

I see a threading issue when capturing current attributes in cull phase.

My code placed in my derived ShadowTechnique::cull():

void MyShadowVolume::cull( osgUtil::CullVisitor& cv )
{
   ref_ptr< StateSet > currentState = new StateSet;
   cv.getState()->captureCurrentState( *currentState );

   cv.pushStateSet( _ss1 );
   _shadowedScene->Group::traverse( cv );
   cv.popStateSet();

   cv.pushStateSet( _ss2 );
   _shadowedScene->Group::traverse( cv );
   cv.popStateSet();
}

StateSets are not changing. It crashes inside captureCurrentState while I have to wait few seconds. However, the time changes (race-condition?). It looks like threading issue and if I set viewer.setThreadingModel( SingleThreaded ), the problem seems to disappear.

Is the code above correct? Am I using captureCurrentState correctly? I need it to determine FrontFace attribute settings.
Thanks,
John






_______________________________________________
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