[osg-users] Problems add a viewer

michael kapelko kornerr at gmail.com
Fri Sep 18 04:44:26 PDT 2015


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 <
alvaroginestar at hotmail.com>:

> 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
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150918/1313c5f4/attachment-0003.htm>


More information about the osg-users mailing list