[osg-users] Using OsgViewerMFC to load a sphere

spowers at gdrs.com spowers at gdrs.com
Tue Jul 15 08:29:11 PDT 2008


Hi and welcome to OSG.
 
You need to make sure your viewport and projection matrix have
equivalent aspect ratios.
 
The best way to do this in MFC is to use the viewport dimensions that
your using (traits->width, traits->height) and then change your
projection matrix to match that aspect ratio.
 
-Steve
 
 
 
________________________________

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of TANG
Fangqin
Sent: Tuesday, July 15, 2008 10:34 AM
To: osg-users at lists.openscenegraph.org
Subject: [osg-users] Using OsgViewerMFC to load a sphere
 
Hi All,
 
I am a beginner of OSG. 
I used OsgViewerMFC to load a sphere into the scene, but it displays as
an ellipsoid.
The radius doesn't seem to be equal in two orthotropic axes.
 
I find that it may be related to the width and height of the view window
when initializing.
 
The following codes are from OsgViewerMFC:
 
::GetWindowRect(m_hWnd, &rect);
...
traits->x = 0;
traits->y = 0;
traits->width = rect.right - rect.left;
traits->height = rect.bottom - rect.top;
...
osg::GraphicsContext* gc =
osg::GraphicsContext::createGraphicsContext(traits.get());
 
How to solve this?
Thanks for your advices in advance.
Tang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080715/93329386/attachment-0003.htm>


More information about the osg-users mailing list