Hi Cory,

I have similar problem in osgviewerWX. Initial aspect ratio should be
computed from client rectangle of viewer window, but currently it is
computed from window rectangle of main frame. Client rectangle is not known
until first resize event. The solution would be to postpone viewer
initialization until we got valid window size, but I haven't tried this yet.
IMHO it is too much hassle only to have square aspect ratio.

As far as I remember when window is resized aspect ratio is only rescaled
instead of being recalculated, so initial "invalid" aspect propagates. IMHO
the "right" solution is to add computation of square aspect ratio directly
into viewer resize functionality. Any suggestions how to do it?

Regards,
Maciej

2009/2/11 Robert Osfield <[email protected]>

> Hi Cory,
>
> I'm not personally familiar with the osgviewerMFC example as I'm don't
> have windows here.  I general I'd point the figure at the way the
> window and associated cameras are initialized, clearly it must being
> setup without the correct aspect ratio. Have a look at the other
> examples that use window inheritance when setting up the
> GraphicsWindows such as osgviewerQT and osgviewerWX.
>
> Robert.
>
> On Tue, Feb 10, 2009 at 8:48 PM, Cory Riddell <[email protected]> wrote:
> > FWIW, I've attached a screen shot of what should be a square. The
> Drawable
> > code was taken from the quickstart guide and the vertices are:
> >     v->push_back(osg::Vec3(-1.f, 0.f, -1.f));
> >     v->push_back(osg::Vec3(1.f, 0.f, -1.f));
> >     v->push_back(osg::Vec3(1.f, 0.f, 1.f));
> >     v->push_back(osg::Vec3(-1.f, 0.f, 1.f));
> > Any ideas?
> >
> >
> >
> >
> > Cory Riddell wrote:
> >
> > I've been playing with osgviewerMFC and I've noticed that when I open an
> > osg file (like cow.osg), the rendering is "stretched" to fit the aspect
> > ratio of the containing window. For example, if I resize the app to be
> > wide then open the cow, I get a very long cow. If I make the window
> > short and tall then open the cow, I get a very compressed cow. Resizing
> > the window does resize the cow, but the aspect ratio doesn't change.
> >
> > osgviewerQT doesn't have this problem but I don't see what's different.
> >
> > What controls the aspect ratio of the rendering?
> >
> > BTW, my cow.osg is from 2.6. Has the osg file format changed?
> >
> > Cory
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to