You try to return a variable that only exists inside the function you call. By the time it's referenced, it no longer exists. Create your viewer variable outside the function.
2015-09-18 18:25 GMT+07:00 alvaro ginestar rodriguez < [email protected]>: > Hi everyone, I have a function that returns the viewer settings, but not > pass it on to the viewer as the main function, any suggestions? > the fuction is that: > > osgViewer::Viewer multiventana(int x, int y, int alto, int ancho, int > numColumns, int numRows) > { > > osgViewer::Viewer viewer; > > int tileWidth = alto / numColumns; > int tileHeight = ancho / numRows; > for (int i = 0; i<numRows; ++i) > { > for (int j = 0; j<numColumns; ++j) > { > osg::ref_ptr<osg::Camera> camera = createSlaveCamera((tileWidth*j) + x, > (ancho - tileHeight*(i + 1)) + y, tileWidth - 1, tileHeight - 1); > osg::Matrix projOffset = osg::Matrix::scale(numColumns, numRows, 1.0) * > osg::Matrix::translate(numColumns > - 1 - 2 * j, numRows - 1 - 2 * i, 0.0); > viewer.addSlave(camera, projOffset, osg::Matrix(), true); > } > } > return viewer; > } > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

