|
楼主 |
发表于 2011-4-15 13:55:53
|
显示全部楼层
回复 3# array
设置了之后还是没有效果。。。两个camera还是一起动。。。
- // 初始化一个相机
- osg::ref_ptr<osg::Camera> camera = new osg::Camera;
- camera->setGraphicsContext(gc.get());
- //相机视口设置
- camera->setViewport(new osg::Viewport(traits->x, traits->y, traits->width, traits->height));
-
- // 添加相机到VIEWER
- mViewer->addSlave(camera.get());
- //后视图
- double aspectRatioScale = 1.0;
- osg::ref_ptr<osg::Camera> cameraBack = new osg::Camera;
- //设置上下文
- cameraBack->setGraphicsContext(gc.get());
- cameraBack->setAllowEventFocus(false);
- //设置后视图的窗口位置
- cameraBack->setViewport(new osg::Viewport(traits->x, traits->y, traits->width/4, traits->height/4));
- GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
- cameraBack->setDrawBuffer(buffer);
- cameraBack->setReadBuffer(buffer);
- //添加相机到视口
- mViewer->addSlave(cameraBack.get(), osg::Matrixd(), osg::Matrixd::lookAt(Vec3(0, -5,70), Vec3(0, 0, 0),Vec3(0, 1, 0)));
复制代码 |
|