<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>thanks!!  but how i add the viewer in the viewer main?<br><br><div><hr id="stopSpelling">Date: Fri, 18 Sep 2015 18:44:26 +0700<br>From: kornerr@gmail.com<br>To: osg-users@lists.openscenegraph.org<br>Subject: Re: [osg-users] Problems add a viewer<br><br><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="ecxgmail_extra"><br><div class="ecxgmail_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="ecxgmail_quote" style="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>
<br>_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</div>                                     </div></body>
</html>