Added setting of the Camera's projection matrix to fit the windowing aspect ratio.

This commit is contained in:
Robert Osfield
2007-06-23 11:21:54 +00:00
parent 4a315e47fe
commit 581b1c322e
4 changed files with 5 additions and 1 deletions

View File

@@ -825,6 +825,7 @@ GraphicsWindowEmbedded* Viewer::setUpViewerAsEmbeddedInWindow(int x, int y, int
setThreadingModel(SingleThreaded);
osgViewer::GraphicsWindowEmbedded* gw = new osgViewer::GraphicsWindowEmbedded(x,y,width,height);
getCamera()->setViewport(new osg::Viewport(0,0,width,height));
getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height), 1.0f, 10000.0f);
getCamera()->setGraphicsContext(gw);
return gw;
}