Hi all,

I have a problem with changing viewports. The aim is to turn a stereo 
modus or mono modus each time user has pressed a specified key.

In this way I try to turn stereo modus on:

----------------------------------------------------------------------
ViewportPtr vpleft,vpright;
ViewportPtr vp;
PerspectiveCameraPtr cam;

vp = pwin->getPort(0);
cam = PerspectiveCameraPtr::dcast(vp->getCamera());

// decorators
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);
      // viewports
vpleft = vp;
vpright = Viewport::create();

beginEditCP(vpleft);
  vpleft->setCamera(decoleft);
  vpleft->setLeft(0);
  vpleft->setRight(0.5);
  vpleft->setBottom(0);
  vpleft->setTop(1);
endEditCP  (vpleft);

beginEditCP(vpright);
  vpright->setCamera(decoright);
  vpright->setLeft(0.5);
  vpright->setRight(1);
  vpright->setBottom(0);
  vpright->setTop(1);
  vpright->setBackground(vp->getBackground());
  vpright->setRoot(vp->getRoot());
endEditCP  (vpright);

// sub / add viewports
beginEditCP(pwin);  pwin->subPort(vp);   pwin->addPort(vpleft);   
pwin->addPort(vpright);  endEditCP  (pwin); // make it notice the 
changes
mgr->setWindow(pwin );
    // show the whole scene
mgr->showAll();
----------------------------------------------------------------------

And in this way I try to turn on mono modus:

----------------------------------------------------------------------
vpleft = pwin->getPort(0);
vpright = pwin->getPort(1);

beginEditCP(vpleft);
  vpleft->setLeft(0);
  vpleft->setRight(1);
  vpleft->setBottom(0);
  vpleft->setTop(1);
endEditCP  (vpleft);

beginEditCP(pwin);  pwin->subPort(vpright);
endEditCP(pwin); // make it notice the changes
mgr->setWindow(pwin );
    // show the whole scene
mgr->showAll();
----------------------------------------------------------------------

But it works only one time: start the program, turn to stereo modus, 
turn to mono modus and than I get following message:

"Unhandled exception at 0x014fa44c in 01hello.exe: 0xC0000005: Access 
violation reading location 0x00000000."

And after clicking on "break":

"There is no source code available for the current location."

Is there something important that have been done by changing viewports?

---
Sergej


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to