[osg-users] some problem about hud and window size

Trajce Nikolov NICK trajce.nikolov.nick at gmail.com
Wed May 4 09:18:59 PDT 2016


wrong :-) .. In the update callback get a handle of the main camera :-)

Cheers,
Nick

On Wed, May 4, 2016 at 6:17 PM, Trajce Nikolov NICK <
trajce.nikolov.nick at gmail.com> wrote:

> hi,
>
> you can do an UpdateCallback for your ortho camera that will set the
> proper dimensions based on the Viewport
>
> something like this:
> struct UpdateOrthoCameraCallback : public osg::NodeCallback
> {
> virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
> {
> osg::Camera* camera = dynamic_cast<osg::Camera*>(node);
> if (camera)
> {
> osg::Viewport* vp = camera->getViewport();
> camera->setProjectionMatrix(osg::Matrixd::ortho2D(0, vp->width(), 0,
> vp->height()));
> }
> }
> };
> myOrthoCamera->setUpdateCallback(new UpdateOrthoCameraCallback);
>
> On Tue, May 3, 2016 at 11:35 AM, John Lee <357059570 at qq.com> wrote:
>
>> Hi,
>>
>> 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.
>> Can anyone tell me how can i solve this problem.
>>
>> Thank you!
>>
>> Cheers,
>> Lee
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=67044#67044
>>
>>
>>
>>
>> Attachments:
>> http://forum.openscenegraph.org//files/2_198.png
>> http://forum.openscenegraph.org//files/1_180.png
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
>
> --
> trajce nikolov nick
>



-- 
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160504/8505aaf9/attachment-0003.htm>


More information about the osg-users mailing list