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.n...@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 <357059...@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@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
>
> --
> trajce nikolov nick
>



-- 
trajce nikolov nick
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to