[osg-users] embedding osg::viewer

Noè Murr nosba95 at yahoo.com
Sat Aug 31 13:30:55 PDT 2019


Little update to the previous post:

I have read the implementation of osgviewer::Viewer::setUpViewerAsEmbeddedInWidnow() method and this is the code:


Code:

GraphicsWindowEmbedded* Viewer::setUpViewerAsEmbeddedInWindow(int x, int y, int width, int height)
{
    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;
}




I think that the viewport of the camera should be changed to: 
    getCamera()->setViewport(new osg::Viewport(x,y,width,height));

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







More information about the osg-users mailing list