I have an app which uses osg::Camera to render to a shadow map. This works fine until the I try to run it old hardware that does not support frame buffer objects and the render target falls back to a one which causes a seperate GraphicsContext to be set up. This means that the following piece of code in RenderStage::draw fails because callingContext is not a valid pointer.

    if (_graphicsContext.valid() && _graphicsContext != callingContext)
    {
        // show we release the context so that others can use it?? will do so right
        // now as an experiment.
        callingContext->releaseContext();  !!! Crashes here

This is because _graphicsContext is being set to the context created in the runCameraSetup but callingContext is set to _renderInfo.getState()->getGraphicsContext() which has not been set up by osgUtil::SceneView.

Do I need to fix this by putting a valid GraphicsConext in the Sceneview RenderInfo. If so how should I set that up (I have never bothered before). Or should I just modify  the code in RenderStage::draw like this..

    if (_graphicsContext.valid() && callingContext.valid() &&_graphicsContext != callingContext)

Comments and ideas welcome.

Thanks

Roger


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

Reply via email to