Added setting of the Camera's projection matrix to fit the windowing aspect ratio.
This commit is contained in:
parent
4a315e47fe
commit
581b1c322e
@ -658,7 +658,7 @@ int main(int argc, char **argv)
|
||||
|
||||
|
||||
// construct the viewer.
|
||||
osgViewer::Viewer viewer;
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
|
||||
// if user request help write it out to cout.
|
||||
unsigned int testCase = 0;
|
||||
|
@ -102,6 +102,7 @@ class ViewerFLTK : public osgViewer::Viewer, public AdapterWidget
|
||||
AdapterWidget(x,y,w,h,label)
|
||||
{
|
||||
getCamera()->setViewport(new osg::Viewport(0,0,w,h));
|
||||
getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(w)/static_cast<double>(h), 1.0f, 10000.0f);
|
||||
getCamera()->setGraphicsContext(getGraphicsWindow());
|
||||
setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||
}
|
||||
|
@ -147,6 +147,8 @@ class ViewerQT : public osgViewer::Viewer, public AdapterWidget
|
||||
{
|
||||
getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));
|
||||
getCamera()->setGraphicsContext(getGraphicsWindow());
|
||||
getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width())/static_cast<double>(height()), 1.0f, 10000.0f);
|
||||
|
||||
setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||
|
||||
connect(&_timer, SIGNAL(timeout()), this, SLOT(updateGL()));
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user