> I'm hoping Paul Martz will volunteer his experiences, as he > did just this at his previous job ;-)
I can take a hint. :-) Possible? Yes. Difficult? There will be some issues you'll need to deal with, but they aren't insurmountable. The primary issue I ran into, as Robert said, was OpenGL state. My existing application rendering code, and OSG, both assumed that they owned the OpenGL state machine. To illustrate, let's say my application left blending enabled just before rendering the OSG part of the scene. The OSG scene graph needed to do rendering with blending disabled, so it disabled it. However, my application rendering code did not know that an external entity had disabled blending, and it assumed blending was still enabled. As a result, when it came time to render the next frame, my application rendering code would render geometry that was supposed to be transparent, with blending disabled. Ooops! Simply wrapping the OSG cull/render traversal with glPushAttrib/glPopAttrib was insufficient, because the converse situation could also occur. So, in addition to wrapping the OSG code in glPushAttrib/glPopAttrib, I also had to create a new method in osg::StateSet, which I called syncState(), which looped over state modes and explicitly set their values in OpenGL regardless of whether OSG thought they were dirty or not. I attached this StateSet to the root node of the OSG scene graph, and used it for state global to that scene graph. Then I just called that syncState() method, on the StateSet attached to the root node, prior to the OSG cull/render traversals. Don't look for syncState() in osg::StateSet. We had this in a derived class that was kept proprietary at my old employer. We never contributed it back to OSG. Fortunately, OSG is open source and you can do these kinds of things. If we were in a similar situation with a closed source scene graph, we would've been screwed. Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com 303 859 9466 _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
