[osg-users] CullVisitor::apply(Geode&) detected NaN,

Rômulo Cerqueira romulogcerqueira at gmail.com
Sat Sep 2 15:04:55 PDT 2017


Hi guys,

I found and solved the problem! :D

When I grab the osg scene at first time, my view matrix is NaN; from the second time, this matrix is correctly filled. 

Then, I modified the grabImage method to replace when the view matrix is NaN by the identity matrix, as follows:


Code:

osg::ref_ptr<osg::Image> ImageViewerCaptureTool::grabImage(osg::ref_ptr<osg::Node> node) {
    // set the current root node
    _viewer->setSceneData(node);

    // if the view matrix is invalid (NaN), use the identity
    osg::ref_ptr<osg::Camera> camera = _viewer->getCamera();
    if (camera->getViewMatrix().isNaN())
        camera->setViewMatrix(osg::Matrix::identity());

    // grab the current frame
    _viewer->frame();
    return _capture->captureImage();
}




Thanks for all messages!

Cheers,

Rômulo

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71615#71615







More information about the osg-users mailing list