<div dir="ltr">hi,<div><br></div><div>you can do an UpdateCallback for your ortho camera that will set the proper dimensions based on the Viewport</div><div><br></div><div>something like this:</div><div><div>struct UpdateOrthoCameraCallback : public osg::NodeCallback</div><div>{</div><div><span class="" style="white-space:pre">     </span>virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);</div><div><span class="" style="white-space:pre">    </span>{</div><div><span class="" style="white-space:pre">          </span>osg::Camera* camera = dynamic_cast<osg::Camera*>(node);</div><div><span class="" style="white-space:pre">              </span>if (camera)</div><div><span class="" style="white-space:pre">                </span>{</div><div><span class="" style="white-space:pre">                  </span>osg::Viewport* vp = camera->getViewport();</div><div><span class="" style="white-space:pre">                      </span>camera->setProjectionMatrix(osg::Matrixd::ortho2D(0, vp->width(), 0, vp->height()));</div><div><span class="" style="white-space:pre">              </span>}</div><div><span class="" style="white-space:pre">  </span>}</div><div>};</div><div>myOrthoCamera->setUpdateCallback(new UpdateOrthoCameraCallback);</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 3, 2016 at 11:35 AM, John Lee <span dir="ltr"><<a href="mailto:357059570@qq.com" target="_blank">357059570@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
First, I drew some tags dynamically using HUD camera on the render window size which is 1100X679, but when I change the length-width ratio of the render window size, the tags positions changed and it was wrong.<br>
Can anyone tell me how can i solve this problem.<br>
<br>
Thank you!<br>
<br>
Cheers,<br>
Lee<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=67044#67044" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=67044#67044</a><br>
<br>
<br>
<br>
<br>
Attachments:<br>
<a href="http://forum.openscenegraph.org//files/2_198.png" rel="noreferrer" target="_blank">http://forum.openscenegraph.org//files/2_198.png</a><br>
<a href="http://forum.openscenegraph.org//files/1_180.png" rel="noreferrer" target="_blank">http://forum.openscenegraph.org//files/1_180.png</a><br>
<br>
<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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">trajce nikolov nick<br></div>
</div>