本文整理汇总了C++中ViewportPtr::getRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewportPtr::getRoot方法的具体用法?C++ ViewportPtr::getRoot怎么用?C++ ViewportPtr::getRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewportPtr
的用法示例。
在下文中一共展示了ViewportPtr::getRoot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// create the decorators and the second viewport
ViewportPtr vpleft,vpright;
decoleft = ShearedStereoCameraDecorator::create();
decoright = ShearedStereoCameraDecorator::create();
beginEditCP(decoleft);
decoleft->setEyeSeparation(ed);
decoleft->setZeroParallaxDistance(zpp);
decoleft->setLeftEye(true);
decoleft->setDecoratee(cam);
endEditCP (decoleft);
beginEditCP(decoright);
decoright->setEyeSeparation(ed);
decoright->setZeroParallaxDistance(zpp);
decoright->setLeftEye(false);
decoright->setDecoratee(cam);
endEditCP (decoright);
if(amberblue)
{
ColorBufferViewportPtr svpleft = ColorBufferViewport::create();
ColorBufferViewportPtr svpright = ColorBufferViewport::create();
beginEditCP(svpleft);
svpleft->setLeft(0);
svpleft->setRight(1);
svpleft->setBottom(0);
svpleft->setTop(1);
svpleft->setCamera(decoleft);
svpleft->setBackground(vp->getBackground());
svpleft->setRoot(vp->getRoot());
svpleft->setRed(GL_TRUE);
svpleft->setGreen(GL_TRUE);
svpleft->setBlue(GL_FALSE);
svpleft->setAlpha(GL_TRUE);
endEditCP (svpleft);
beginEditCP(svpright);
svpright->setLeft(0);
svpright->setRight(1);
svpright->setBottom(0);
svpright->setTop(1);
svpright->setCamera(decoright);
svpright->setBackground(vp->getBackground());
svpright->setRoot(vp->getRoot());
svpright->setRed(GL_FALSE);
svpright->setGreen(GL_FALSE);
svpright->setBlue(GL_TRUE);
svpright->setAlpha(GL_FALSE);
endEditCP (svpright);
vpleft = svpleft;
vpright = svpright;
}
else if(stereobuffer)
{
StereoBufferViewportPtr svpleft = StereoBufferViewport::create();
StereoBufferViewportPtr svpright = StereoBufferViewport::create();
beginEditCP(svpleft);
svpleft->setLeft(0);
svpleft->setRight(1);
svpleft->setBottom(0);
示例2: main
// Initialize GLUT & OpenSG and set up the scene
int main(int argc, char **argv)
{
// OSG init
glutInit(&argc, argv);
osgInit(argc, argv);
std::string fontfile("testfont.ttf");
std::string testtext("Test Text");
UInt32 drawmode;
if(argc > 1)
testtext = argv[1];
if(argc > 2)
fontfile = argv[2];
if(argc < 4 || sscanf(argv[3], "%d", &drawmode) != 1 )
drawmode = FTGLFont::Outline;
// GLUT
int winid = setupGLUT(&argc, argv);
GLUTWindowPtr gwin= GLUTWindow::create();
gwin->setId(winid);
gwin->init();
// Create the Cubes node
NodePtr scene = makeCoredNode<Group>();
beginEditCP(scene);
scene->addChild( makeBox(200,200,200, 1,1,1) );
// scene->addChild( SceneFileHandler::the().read("tie.wrl") );
endEditCP(scene);
// Create the text
FTGLFontPtr font = FTGLFont::create();
beginEditCP(font);
font->setName(fontfile);
font->setDrawType(drawmode);
font->setSize(40);
font->setRes(72);
font->setDepth(20);
endEditCP(font);
FTGLTextPtr text;
NodePtr tnode = makeCoredNode<FTGLText>(&text);
beginEditCP(text);
text->setFont(font);
text->setText(testtext);
text->setPosition(Pnt3f(0,300,0));
text->setMaterial(getDefaultMaterial());
endEditCP(text);
beginEditCP(scene);
scene->addChild(tnode);
endEditCP(scene);
// create the SimpleSceneManager helper
mgr = new SimpleSceneManager;
// tell the manager what to manage
mgr->setWindow(gwin );
mgr->setRoot (scene);
// show the whole scene
mgr->showAll();
// copy to second window
int winid2 = setupGLUT(&argc, argv);
gwin2= GLUTWindow::create();
gwin2->setId(winid2);
gwin2->init();
ViewportPtr ovp = gwin->getPort()[0];
ViewportPtr vp = Viewport::create();
beginEditCP(vp);
vp->setLeft(0);
vp->setRight(400);
vp->setBottom(0);
vp->setTop(400);
vp->setCamera(ovp->getCamera());
vp->setRoot(ovp->getRoot());
vp->setBackground(ovp->getBackground());
vp->setParent(gwin2);
endEditCP(vp);
beginEditCP(gwin2);
gwin2->getPort().push_back(vp);
endEditCP(gwin2);
// GLUT main loop
//.........这里部分代码省略.........