Hi Tim,

Tim Moore wrote:

On Wed, Aug 4, 2010 at 9:33 AM, PCJohn <pec...@fit.vutbr.cz <mailto:pec...@fit.vutbr.cz>> wrote:

    Hi,

    captureCurrentState name is misleading - it is not capturing state
    from OpenGL.
    It should be, maybe, getCurrentState. It is just taking last
    pushed attributes on the state stack. These attributes are
    returned in the StateSet given as parameter. Thus, the function
    should work any time during cull traversal, I guess.

No. CullVisitor::pushStateSet does not affect the graphics state immediately. It is used to build the state graph that is used during the draw traversal to change the state. You really can't use osg::State for much outside of the graphics traversal.
We do not understand each other. I am not using it outside cull traversal, neither I want to do anything with OpenGL state.

    I do not understand, but it work with SingleThreaded and
    CullDrawThreadPerContext while it crashes with
    DrawThreadPerContext and  CullThreadPerCameraDrawThreadPerContext.
    It seems to me like two threads are accessing state stack...

There isn't a state stack. See http://www.bricoworks.com/articles/stateset/stateset.html and http://www.bricoworks.com/articles/stategraph/stategraph.html.

Yes. There is. Oh. I see. Sorry for confusion, you call it attribute stack.... and that is a correct name for it. Anyway, there is State::_attributeMap that is composed of AttributeStack structs and they have a member attributeVec that is serving as a stack of attributes. The top of the stack is "current" attribute or the last pushed attribute. That is the one I need to get. Until now, I see a threading issue like two threads manipulating the "attribute stack".

John

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to