|
楼主 |
发表于 2012-8-1 16:12:12
|
显示全部楼层
pView1->initialize(pGraphicsContext.get(), false);
pView1->getContext()->getCamera()->setClearColor(osg::Vec4f(0.0f, 0.0f, 0.0f, 1.0f));
pView1->getContext()->getCamera()->setViewport(new osg::Viewport(traits->x, traits->y, traits->width, traits->height));
pView1->getContext()->getViewer()->getCamera()->setProjectionMatrixAsPerspective(45.0, double(traits->width) / double(traits->height), 1.0, 1000.0);
pView1->getContext()->getCamera()->setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
pView1->getContext()->getCamera()->setNearFarRatio(0.00001f);
pView2->initialize(pGraphicsContext.get(), false);
pView2->getContext()->getCamera()->setClearColor(osg::Vec4f(1.0f, 1.0f, 1.0f, 1.0f));
pView2->getContext()->getCamera()->setViewport(new osg::Viewport(traits->x, traits->y, 0, 0));
pView2->getContext()->getViewer()->getCamera()->setProjectionMatrixAsPerspective(45.0, double(traits->width) / double(traits->height), 1.0, 1000.0);
pView2->getContext()->getCamera()->setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
pView2->getContext()->getCamera()->setNearFarRatio(0.00001f);
if(pView1)
{
pView1->getContext()->getCamera()->setViewport(0, 0, 0, 0);
}
if(pView2)
{
pView2->getContext()->getCamera()->setViewport(0, 0, width, height);
pView2->getContext()->getCamera()->setProjectionMatrix(osg::Matrix::perspective(45.0, double(width) / double(height), 1.0, 1000.0)); |
|