<div dir="ltr">You try to return a variable that only exists inside the function you call. By the time it's referenced, it no longer exists.<div>Create your viewer variable outside the function.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-18 18:25 GMT+07:00 alvaro ginestar rodriguez <span dir="ltr"><<a href="mailto:alvaroginestar@hotmail.com" target="_blank">alvaroginestar@hotmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr">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?<div>the fuction is that:</div><div><br></div><div><div>osgViewer::Viewer multiventana(int x, int y, int alto, int ancho, int numColumns, int numRows)</div><div>{</div><div><br></div><div><span style="white-space:pre-wrap">   </span>osgViewer::Viewer viewer;</div><div><br></div><div><span style="white-space:pre-wrap">       </span>int tileWidth = alto / numColumns;</div><div><span style="white-space:pre-wrap">       </span>int tileHeight = ancho / numRows;</div><div><span style="white-space:pre-wrap">        </span>for (int i = 0; i<numRows; ++i)</div><div><span style="white-space:pre-wrap">       </span>{</div><div><span style="white-space:pre-wrap">                </span>for (int j = 0; j<numColumns; ++j)</div><div><span style="white-space:pre-wrap">            </span>{</div><div><span style="white-space:pre-wrap">                        </span>osg::ref_ptr<osg::Camera> camera = createSlaveCamera((tileWidth*j) + x, (ancho - tileHeight*(i + 1)) + y, tileWidth - 1, tileHeight - 1);</div><div><span style="white-space:pre-wrap">                  </span>osg::Matrix projOffset = osg::Matrix::scale(numColumns, numRows, 1.0) *<span style="white-space:pre-wrap"> </span>osg::Matrix::translate(numColumns - 1 - 2 * j, numRows - 1 - 2 * i, 0.0);</div><div><span style="white-space:pre-wrap">                        </span>viewer.addSlave(camera, projOffset, osg::Matrix(), true);</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>return viewer;</div><div>}</div></div><div><br></div>                                      </div></div>
<br>_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
<br></blockquote></div><br></div>