> First I thought that something like > > .... > osg::State *pState = _sceneView->getState() ; > > pState->dirtyAllAttributes() ; > pState->dirtyAllModes() ; > pState->apply() ; > .... > > before calling "_sceneView->draw()" should help, but I looks > like I'm on the wrong track....
Déjà vu! :-) It is both amusing and sad to see you struggling with the same issues I remember struggling with. IIRC, there is no way to "dirty" a mode -- it's either on or off. The dirtyAllModes() method simply flips the current state to the opposite of what OSG thinks it is. As a result, this is not a complete solution. Suppose the first half of your OSG rendering has blending disabled, and the second half has blending enabled. OSG leaves blending on, the pop attribute turns it off again, then let's say your app turns blending back on just before the next OSG pass (because something that wasn't there before just popped into view and it required blending). If you then call dirtyAllModes(), OSG then thinks that blending is off when it's actually on, so doesn't bother to disable it for the first half of its rendering. The bottom line is that there's no complete solution in unmodified OSG to handle a situation where the app does OpenGL rendering and believes it owns state. You really need a function in OSG that says "set state the way you think it's currently set". Such a function doesn't exist, and you'll need to write your own. For me and my employer, this was a major inhibitor to adding OSG into our application. We either had to solve this problem (which required surmounting a steep learning curve regarding OSG state handling), or we had to do a complete port so that all rendering was done in OSG. -Paul _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
