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

2016-05-04 Thread Trajce Nikolov NICK
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(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


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

2016-05-04 Thread Trajce Nikolov NICK
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(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
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2016-05-04 Thread John Lee
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


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

2016-05-04 Thread John Lee
Hi,

First i drew some tags by HUD on the window size which is 1100X679, and it was 
correct. But when i change the window's length-width ratio the tag's position 
changed and it became wrong.
Can anyone tell me how i can solve this problem?

Thank you!

Cheers,
John

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67047#67047





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org